diff --git a/.changeset/unlucky-lobsters-train.md b/.changeset/unlucky-lobsters-train.md new file mode 100644 index 0000000..324c72b --- /dev/null +++ b/.changeset/unlucky-lobsters-train.md @@ -0,0 +1,5 @@ +--- +"@sveltejs/eslint-config": major +--- + +breaking: replace deprecated stylistic rules diff --git a/index.js b/index.js index 37aa5ba..cadded9 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ import ts from 'typescript-eslint'; import svelte from 'eslint-plugin-svelte'; import prettier from 'eslint-config-prettier'; import unicorn from 'eslint-plugin-unicorn'; +import stylistic from '@stylistic/eslint-plugin-js'; import globals from 'globals'; /** @type {import('eslint').Linter.FlatConfig[]} */ @@ -14,7 +15,8 @@ export default [ ...svelte.configs['flat/prettier'], { plugins: { - unicorn + unicorn, + '@stylistic': stylistic }, languageOptions: { globals: { @@ -23,7 +25,9 @@ export default [ } }, rules: { - '@typescript-eslint/array-type': [ 'error', { default: 'array-simple' } ], + '@stylistic/quote-props': ['error', 'as-needed'], + '@stylistic/quotes': ['error', 'single', { avoidEscape: true }], + '@typescript-eslint/array-type': ['error', { default: 'array-simple' }], '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/ban-types': 'off', '@typescript-eslint/camelcase': 'off', @@ -36,25 +40,23 @@ export default [ '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-inferrable-types': 'off', '@typescript-eslint/no-object-literal-type-assertion': 'off', + '@typescript-eslint/no-this-alias': 'off', '@typescript-eslint/no-unused-vars': ['error', { args: 'after-used', argsIgnorePattern: '^_' }], '@typescript-eslint/no-use-before-define': 'off', - '@typescript-eslint/no-this-alias': 'off', '@typescript-eslint/prefer-interface': 'off', 'no-constant-condition': ['error', { checkLoops: false }], 'no-duplicate-imports': 'error', 'no-empty': ['error', { allowEmptyCatch: true }], 'no-inner-declarations': 'off', - 'no-sparse-arrays': 'off', 'no-restricted-properties': [ 'error', { object: 'test', property: 'only', message: 'Do not check in test.only tests.' } ], + 'no-sparse-arrays': 'off', + 'prefer-const': ['error', { destructuring: 'all' }], 'no-var': 'error', - 'object-shorthand': [ 'error', 'always' ], + 'object-shorthand': ['error', 'always'], 'prefer-arrow-callback': 'error', - 'prefer-const': [ 'error', { destructuring: 'all' } ], - quotes: ['error', 'single', { avoidEscape: true }], - 'quote-props': [ 'error', 'as-needed' ], 'svelte/no-inner-declarations': 'off', 'unicorn/prefer-node-protocol': 'error' } diff --git a/package.json b/package.json index 425eaab..c67ec19 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "homepage": "https://github.com/svelte/eslint-config#readme", "devDependencies": { "@changesets/cli": "^2.27.1", + "@stylistic/eslint-plugin-js": "^1.7.0", "@svitejs/changesets-changelog-github-compact": "^1.1.0", "eslint": "^9.0.0", "eslint-config-prettier": "^9.1.0", @@ -32,6 +33,7 @@ "typescript-eslint": "^7.6.0" }, "peerDependencies": { + "@stylistic/eslint-plugin-js": ">= 1", "eslint": ">= 9", "eslint-config-prettier": ">= 9", "eslint-plugin-svelte": ">= 2.36", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 70dbe55..c1e6593 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ devDependencies: '@changesets/cli': specifier: ^2.27.1 version: 2.27.1 + '@stylistic/eslint-plugin-js': + specifier: ^1.7.0 + version: 1.7.0(eslint@9.0.0) '@svitejs/changesets-changelog-github-compact': specifier: ^1.1.0 version: 1.1.0 @@ -418,6 +421,20 @@ packages: fastq: 1.17.1 dev: true + /@stylistic/eslint-plugin-js@1.7.0(eslint@9.0.0): + resolution: {integrity: sha512-PN6On/+or63FGnhhMKSQfYcWutRlzOiYlVdLM6yN7lquoBTqUJHYnl4TA4MHwiAt46X5gRxDr1+xPZ1lOLcL+Q==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: '>=8.40.0' + dependencies: + '@types/eslint': 8.56.7 + acorn: 8.11.3 + escape-string-regexp: 4.0.0 + eslint: 9.0.0 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + dev: true + /@svitejs/changesets-changelog-github-compact@1.1.0: resolution: {integrity: sha512-qhUGGDHcpbY2zpjW3SwqchuW8J/5EzlPFud7xNntHKA7f3a/mx5+g+ruJKFHSAiVZYo30PALt+AyhmPUNKH/Og==} engines: {node: ^14.13.1 || ^16.0.0 || >=18} @@ -428,6 +445,13 @@ packages: - encoding dev: true + /@types/eslint@8.56.7: + resolution: {integrity: sha512-SjDvI/x3zsZnOkYZ3lCt9lOZWZLB2jIlNKz+LBgCtDurK0JZcwucxYHn1w2BJkD34dgX9Tjnak0txtq4WTggEA==} + dependencies: + '@types/estree': 1.0.5 + '@types/json-schema': 7.0.15 + dev: true + /@types/estree@1.0.5: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} dev: true