1.4.2 • Published 2 months ago

eslint-plugin-ezlint v1.4.2

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

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 eslint

With pnpm:

pnpm add -D eslint

With yarn:

yarn add -D eslint

Next, install eslint-plugin-ezlint:

With npm:

npm install -D eslint-plugin-ezlint

With pnpm:

pnpm add -D eslint-plugin-ezlint

With yarn:

yarn install -D eslint-plugin-ezlint

2. 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-style
  • dot-notation
  • no-debugger
  • no-bitwise
  • no-invalid-this
  • no-template-curly-in-string
  • no-useless-computed-key
  • no-useless-rename
  • no-useless-return
  • object-shorthand
  • prefer-arrow-callback
  • prefer-destructuring
  • prefer-const
  • prefer-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-duplicates
  • import/no-unresolved
  • import/newline-after-import
  • import/first
  • import/exports-last
  • import/extensions
  • import/order
  • sort-imports

- F. Jsdoc Rules

  • jsdoc/check-access
  • jsdoc/check-alignment
  • jsdoc/check-indentation
  • jsdoc/check-line-alignment
  • jsdoc/check-param-names
  • jsdoc/check-property-names
  • jsdoc/check-syntax
  • jsdoc/check-tag-names
  • jsdoc/check-types
  • jsdoc/check-values
  • jsdoc/empty-tags
  • jsdoc/implements-on-classes
  • jsdoc/informative-docs
  • jsdoc/match-description
  • jsdoc/multiline-blocks
  • jsdoc/no-bad-blocks
  • jsdoc/no-blank-block-descriptions
  • jsdoc/no-defaults
  • jsdoc/no-multi-asterisks
  • jsdoc/require-asterisk-prefix
  • jsdoc/require-hyphen-before-param-description
  • jsdoc/require-param
  • jsdoc/require-param-name
  • jsdoc/require-param-type
  • jsdoc/require-property
  • jsdoc/require-property-name
  • jsdoc/require-property-type
  • jsdoc/require-returns-check
  • jsdoc/require-returns-type
  • jsdoc/require-throws
  • jsdoc/require-yields
  • jsdoc/require-yields-check
  • jsdoc/sort-tags
  • jsdoc/tag-lines
  • jsdoc/valid-types
1.2.0

2 months ago

1.4.2

2 months ago

1.4.1

2 months ago

1.4.0

2 months ago

1.3.1

2 months ago

1.3.0

2 months ago

1.2.1

2 months ago

1.1.8

2 months ago

1.1.7

2 months ago

1.1.6

4 months ago

1.1.5

4 months ago

1.1.4

4 months ago

1.1.1

4 months ago

1.1.3

4 months ago

1.1.2

4 months ago

1.1.0

4 months ago

1.0.35

4 months ago

1.0.26

4 months ago

1.0.29

4 months ago

1.0.28

4 months ago

1.0.27

4 months ago

1.0.30

4 months ago

1.0.25

4 months ago

1.0.24

5 months ago

1.0.19

5 months ago

1.0.18

5 months ago

1.0.17

5 months ago

1.0.22

5 months ago

1.0.21

5 months ago

1.0.20

5 months ago

1.0.23

5 months ago

1.0.16

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.5

5 months ago

1.0.11

5 months ago

1.0.10

5 months ago

1.0.15

5 months ago

1.0.14

5 months ago

1.0.13

5 months ago

1.0.12

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago