19.0.0 • Published 4 months ago

eslint-config-conventions v19.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

📜 About

eslint-config-conventions is a ESLint configuration to enforce strict conventions and good code quality. It supports both JavaScript and TypeScript.

This configuration is mostly for catching bugs and code-quality so it is recommended to use it with Prettier for a consistent code style, it works with any .prettierrc.json configuration.

More information about formatting rules vs code-quality rules can be found on Prettier vs. Linters.

⚙️ Getting Started

Prerequisites

Node.js >= 20.11.0

Installation

npm install --save-dev \
  eslint@^9.21.0 \
  eslint-plugin-promise@^7.2.1 \
  eslint-plugin-unicorn@^57.0.0 \
  eslint-plugin-import-x@^4.6.1 \
  globals@^16.0.0 \
  typescript@^5.7.3 \
  typescript-eslint@^8.24.1 \
  eslint-config-conventions@latest

Dependencies are:

Configuration

eslint.config.js

import typescriptESLint from "typescript-eslint"
import configConventions from "eslint-config-conventions"

export default typescriptESLint.config(...configConventions, {
  files: ["**/*.ts", "**/*.tsx"],
  languageOptions: {
    parser: typescriptESLint.parser,
    parserOptions: {
      projectService: true,
      tsconfigRootDir: import.meta.dirname,
    },
  },
})

Configuration with Prettier (recommended)

npm install --save-dev prettier

# Create an empty config file to let editors and other tools know you are using Prettier
# You can personalize it with your own rules
echo "{}" > .prettierrc.json

That's all! No need to update the eslint.config.js configuration.

We discourage usage of eslint-config-prettier and eslint-plugin-prettier, as eslint-config-conventions doesn't include any stylistic rules, and including these packages has several drawbacks (listed in Integrating with Linters) and brings no benefits for this configuration.

package.json

{
  "scripts": {
    "lint:eslint": "eslint . --max-warnings 0",
    "lint:prettier": "prettier . --check"
  }
}

Usage

node --run lint:eslint
# or to apply automatic fixes to code
node --run lint:eslint -- --fix

# Validate code formatting in all supported languages by Prettier
node --run lint:prettier

💡 Contributing

Anyone can help to improve the project, submit a Feature Request, a bug report or even correct a simple spelling mistake.

The steps to contribute can be found in the CONTRIBUTING.md file.

📄 License

MIT

19.0.0

4 months ago

18.0.2

5 months ago

18.0.1

6 months ago

18.0.0

6 months ago

17.0.1

7 months ago

17.0.0

8 months ago

15.0.0

9 months ago

17.0.0-beta.1

9 months ago

16.0.1

9 months ago

16.0.0

9 months ago

14.4.0

11 months ago

14.3.0

12 months ago

14.2.0

1 year ago

14.1.0

1 year ago

14.0.0

1 year ago

13.1.0

2 years ago

12.0.0

2 years ago

13.0.0

2 years ago

10.0.0

2 years ago

10.1.0

2 years ago

11.0.0

2 years ago

11.0.1

2 years ago

9.0.0

2 years ago

8.0.0

2 years ago

7.0.0

2 years ago

6.0.0

3 years ago

5.0.0

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago