eslint-plugin-ezlint v1.6.6
eslint-plugin-ezlint
This plugin provides a ✨PERFECT✨ match with the following prettier settings:
const config = {
useTabs: false,
tabWidth: 2,
trailingComma: 'all',
semi: true,
singleQuote: true,
jsxSingleQuote: true,
bracketSpacing: true,
arrowParens: 'always',
endOfLine: 'auto',
printWidth: 120,
embeddedLanguageFormatting: 'off',
quoteProps: 'as-needed',
overrides: [
{
files: ['*.mts', '*.cts', '*.ts', '*.d.ts', '*.js', '*.jsx'],
options: { parser: 'typescript' },
},
{
files: ['*.json'],
options: { parser: 'json' },
},
],
};
export default config;In fact, they go so well together, in a way that even hardcoded decisions made by prettier (which aren't configurable by you the developer at all) are caught and flagged by Eslint. I searched for every eslint rule I could possibly find which mimics prettier's code-of-conduct under the hood, so that if a file should be formatted by prettier? There's a 99% chance this eslint config will flag and warn you about it.
In prettier, some configurations are controlled by you. In the prettierrc config above I mentioned a specific set of prettier rules and what their VALUE MUST BE, in order for the two to work perfectly together.
As you probably know, eslint & prettier can collide, and have rule conflict. So this is just to avoid exactly these type of situations. If you find the above rules acceptable by you, you may go ahead and use this plugin with 100% certainty of 0 conflicts.
1. Installation
You'll first need to install ESLint:
With npm:
npm i -D eslintWith pnpm:
pnpm add -D eslintWith yarn:
yarn add -D eslintNext, install eslint-plugin-ezlint:
With npm:
npm install -D eslint-plugin-ezlintWith pnpm:
pnpm add -D eslint-plugin-ezlintWith yarn:
yarn install -D eslint-plugin-ezlint2. Usage
Add ezlint to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"extends": ["plugin:ezlint/recommended"]
}3. Behind the scenes - ezlint
Parser
By default, eslint uses "espree" as its parser. It behaves "ok" for the most part, but it has trouble with:
- importing files with extensions:
.cts,.mts,.ts,.tsx,.d.cts,.d.mts,.d.ts. - using paths defined in tsconfig.json
- resolving @types/* definitions over plain .js/.jsx
- imports/exports fields support in package.json
That's why under the hood ezlint uses eslint-import-resolver-typescript, to mitigate all of the points mentioned above.
4. Rules
The rules inside the recommended config are divided into 6 groups:
- base Rules
- stylistic Rules
- typescript Rules
- export Rules
- import Rules
- jsdoc Rules
- A. Base Rules
arrow-body-styledot-notationno-debuggerno-bitwiseno-invalid-thisno-template-curly-in-stringno-useless-computed-keyno-useless-renameno-useless-returnobject-shorthandprefer-arrow-callbackprefer-destructuringprefer-constprefer-template
- B. Stylistic Rules
@stylistic/array-bracket-spacing@stylistic/arrow-spacing@stylistic/comma-dangle@stylistic/comma-spacing@stylistic/comma-style@stylistic/computed-property-spacing@stylistic/dot-location@stylistic/eol-last@stylistic/func-call-spacing@stylistic/function-call-argument-newline@stylistic/jsx-quotes@stylistic/key-spacing@stylistic/keyword-spacing@stylistic/max-len@stylistic/new-parens@stylistic/no-extra-parens@stylistic/no-floating-decimal@stylistic/no-multi-spaces@stylistic/no-multiple-empty-lines@stylistic/no-tabs@stylistic/no-trailing-spaces@stylistic/no-whitespace-before-property@stylistic/object-curly-spacing@stylistic/object-curly-newline@stylistic/operator-linebreak@stylistic/padded-blocks@stylistic/quote-props@stylistic/quotes@stylistic/rest-spread-spacing@stylistic/semi@stylistic/semi-spacing@stylistic/semi-style@stylistic/space-before-blocks@stylistic/space-before-function-paren@stylistic/space-in-parens@stylistic/space-infix-ops@stylistic/space-unary-ops@stylistic/spaced-comment@stylistic/template-curly-spacing
- C. Typescript Rules
@typescript-eslint/no-unused-vars- all of typescript's eslint recommended rules, except:
• @typescript-eslint/no-explicit-any
• '@typescript-eslint/ban-ts-comment
- D. Export Rules
sort-exports/sort-exports
- E. Import Rules
import/no-duplicatesimport/no-unresolvedimport/newline-after-importimport/firstimport/exports-lastimport/extensionsimport/ordersort-imports
- F. Jsdoc Rules
jsdoc/check-accessjsdoc/check-alignmentjsdoc/check-indentationjsdoc/check-line-alignmentjsdoc/check-param-namesjsdoc/check-property-namesjsdoc/check-syntaxjsdoc/check-tag-namesjsdoc/check-typesjsdoc/check-valuesjsdoc/empty-tagsjsdoc/implements-on-classesjsdoc/informative-docsjsdoc/match-descriptionjsdoc/multiline-blocksjsdoc/no-bad-blocksjsdoc/no-blank-block-descriptionsjsdoc/no-defaultsjsdoc/no-multi-asterisksjsdoc/require-asterisk-prefixjsdoc/require-hyphen-before-param-descriptionjsdoc/require-paramjsdoc/require-param-namejsdoc/require-param-typejsdoc/require-propertyjsdoc/require-property-namejsdoc/require-property-typejsdoc/require-returns-checkjsdoc/require-returns-typejsdoc/require-throwsjsdoc/require-yieldsjsdoc/require-yields-checkjsdoc/sort-tagsjsdoc/tag-linesjsdoc/valid-types
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago