1.18.0 • Published 4 months ago

@cyansalt/eslint-config-preset v1.18.0

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

@cyansalt/eslint-config-preset

npm

My ESLint configuration preset.

Installation

npm install --save-dev @cyansalt/eslint-config-preset

Usage

// .eslintrc.js
module.exports = {
  // ...
  extends: [
    '@cyansalt/preset',
  ],
  // ...
}

Or for Flat Config:

// eslint.config.js
import presetConfig from '@cyansalt/eslint-config-preset/flat/index.mjs'

export default {
  // ...
  ...presetConfig,
  // ...
}

The ruleset will check your project dependencies and enable available configurations automatically. This eliminates the need for you to know any specific ruleset configuration.

Vue SFC in TypeScript

By default, Vue SFCs with lang="ts" will only have a part of the simplest TS rules in a mixed TS project (without checkJs: true specified in compilerOptions of tsconfig.json), such as @typescript-eslint/type-annotation-spacing. For rules that rely on TS language services, such as @typescript-eslint/no-unnecessary-condition, the rules can be generated as follows:

// .eslintrc.js
const { createVueTsConfig } = require('@cyansalt/eslint-config-preset/vue-utils')

module.exports = {
  // ...
  extends: [
    '@cyansalt/preset',
  ],
  overrides: [
    ...createVueTsConfig({ cwd: __dirname }),
  ],
  // ...
}

Or for Flat Config:

// eslint.config.js
import * as url from 'node:url'
import presetConfig from '@cyansalt/eslint-config-preset/flat/index.mjs'
import { createVueTsConfig } from '@cyansalt/eslint-config-preset/flat/vue-utils.mjs'

const dir = url.fileURLToPath(new URL('.', import.meta.url))

export default [
  // ...
  ...presetConfig,
  ...createVueTsConfig({ cwd: dir }),
  // ...
]

Rule generation is usually fast (<=1s), but the time it takes for ESLint to use them will grow rapidly with the number of Vue SFC files with lang="ts" in your project. Please be careful yourself!

Also see @cyansalt/eslint-config.

1.18.0

4 months ago

1.16.3

6 months ago

1.16.2

6 months ago

1.16.1

6 months ago

1.16.0

6 months ago

1.15.0

9 months ago

1.17.0

6 months ago

1.14.0

11 months ago

1.13.0

1 year ago

1.12.6

1 year ago

1.12.5

1 year ago

1.12.3

1 year ago

1.12.4

1 year ago

1.12.2

1 year ago

1.12.1

1 year ago

1.12.0

1 year ago

1.11.1

1 year ago

1.11.0

1 year ago

1.10.0

2 years ago

1.9.0

2 years ago

1.8.0

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago