@egs33/eslint-config 2.2.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,43 +1,41 @@
1
1
  {
2
2
  "name": "@egs33/eslint-config",
3
3
  "description": "eslint config for me",
4
- "version": "2.2.1",
4
+ "version": "3.0.1",
5
5
  "author": "egs33",
6
6
  "type": "module",
7
7
  "dependencies": {
8
- "@eslint/eslintrc": "^2.0.3",
9
- "eslint-config-airbnb-base": "^15.0.0",
10
- "eslint-config-airbnb-typescript": "^17.0.0",
11
- "eslint-plugin-array-func": "^3.1.7",
12
- "eslint-plugin-import": "^2.26.0",
13
- "eslint-plugin-n": "^16.0.1",
14
- "eslint-plugin-promise": "^6.0.1",
15
- "eslint-plugin-regexp": "^1.9.0",
16
- "globals": "^13.20.0"
8
+ "@eslint/eslintrc": "^3.0.2",
9
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
10
+ "@typescript-eslint/parser": "^7.1.0",
11
+ "eslint-config-airbnb-typescript": "^18.0.0",
12
+ "eslint-plugin-array-func": "^5.0.1",
13
+ "eslint-plugin-import": "^2.29.1",
14
+ "eslint-plugin-n": "^16.6.2",
15
+ "eslint-plugin-promise": "^6.1.1",
16
+ "eslint-plugin-regexp": "^2.2.0",
17
+ "globals": "^14.0.0"
17
18
  },
18
19
  "devDependencies": {
19
- "@typescript-eslint/eslint-plugin": "^6.1.0",
20
- "@typescript-eslint/parser": "^6.1.0",
21
- "eslint": "^8.44.0",
22
- "eslint-plugin-vue": "^9.5.0",
23
- "svelte-eslint-parser": "^0.32.2",
24
- "typescript": "^5.0.2",
25
- "vue-eslint-parser": "^9.1.0"
20
+ "eslint": "^8.57.0 || ^9.0.0",
21
+ "svelte-eslint-parser": "^0.33.1",
22
+ "typescript": "^5.3.3",
23
+ "typescript-eslint": "^7.1.0"
26
24
  },
27
25
  "engines": {
28
- "node": ">=16"
26
+ "node": ">=20"
29
27
  },
30
28
  "files": [
31
29
  "util.js",
32
30
  "base.js",
33
31
  "browser.js",
34
32
  "nodejs.js",
35
- "vue3.js",
36
33
  "typescript-base.js",
37
34
  "typescript-node.js",
38
35
  "typescript-browser.js",
39
36
  "typescript-svelte.js",
40
- "plugin-rules"
37
+ "plugin-rules",
38
+ "airbnb"
41
39
  ],
42
40
  "homepage": "https://github.com/egs33/eslint-config",
43
41
  "keywords": [
@@ -47,30 +45,18 @@
47
45
  "license": "MIT",
48
46
  "main": "nodejs.js",
49
47
  "peerDependencies": {
50
- "@typescript-eslint/eslint-plugin": "^6.1.0",
51
- "@typescript-eslint/parser": "^6.1.0",
52
- "eslint": "^8.44.0",
53
- "eslint-plugin-vue": "^9.5.0",
54
- "svelte-eslint-parser": ">=0.32.2",
55
- "typescript": ">=4.4.4",
56
- "vue-eslint-parser": "^9.1.0"
48
+ "eslint": "^8.57.0",
49
+ "svelte-eslint-parser": ">=0.33.1",
50
+ "typescript": "^5.3.3",
51
+ "typescript-eslint": "^7.1.0"
57
52
  },
58
53
  "peerDependenciesMeta": {
59
- "@typescript-eslint/eslint-plugin": {
60
- "optional": true
61
- },
62
- "@typescript-eslint/parser": {
63
- "optional": true
64
- },
65
- "eslint-plugin-vue": {
54
+ "typescript-eslint": {
66
55
  "optional": true
67
56
  },
68
57
  "svelte-eslint-parser": {
69
58
  "optional": true
70
59
  },
71
- "vue-eslint-parser": {
72
- "optional": true
73
- },
74
60
  "typescript": {
75
61
  "optional": true
76
62
  }
@@ -0,0 +1,265 @@
1
+ export const imports = {
2
+
3
+ // ensure imports point to files/modules that can be resolved
4
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
5
+ 'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
6
+
7
+ // ensure named imports coupled with named exports
8
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
9
+ 'import/named': 'error',
10
+
11
+ // ensure default import coupled with default export
12
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
13
+ 'import/default': 'off',
14
+
15
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/namespace.md
16
+ 'import/namespace': 'off',
17
+
18
+ // Helpful warnings:
19
+
20
+ // disallow invalid exports, e.g. multiple defaults
21
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/export.md
22
+ 'import/export': 'error',
23
+
24
+ // do not allow a default import name to match a named export
25
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
26
+ 'import/no-named-as-default': 'error',
27
+
28
+ // warn on accessing default export property names that are also named exports
29
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
30
+ 'import/no-named-as-default-member': 'error',
31
+
32
+ // disallow use of jsdoc-marked-deprecated imports
33
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
34
+ 'import/no-deprecated': 'off',
35
+
36
+ // Forbid the use of extraneous packages
37
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
38
+ // paths are treated both as absolute paths, and relative to process.cwd()
39
+ 'import/no-extraneous-dependencies': [
40
+ 'error', {
41
+ devDependencies: [
42
+ 'test/**', // tape, common npm pattern
43
+ 'tests/**', // also common npm pattern
44
+ 'spec/**', // mocha, rspec-like pattern
45
+ '**/__tests__/**', // jest pattern
46
+ '**/__mocks__/**', // jest pattern
47
+ 'test.{js,jsx}', // repos with a single test file
48
+ 'test-*.{js,jsx}', // repos with multiple top-level test files
49
+ '**/*{.,_}{test,spec}.{js,jsx}', // tests where the extension or filename suffix denotes that it is a test
50
+ '**/jest.config.js', // jest config
51
+ '**/jest.setup.js', // jest setup
52
+ '**/vue.config.js', // vue-cli config
53
+ '**/webpack.config.js', // webpack config
54
+ '**/webpack.config.*.js', // webpack config
55
+ '**/rollup.config.js', // rollup config
56
+ '**/rollup.config.*.js', // rollup config
57
+ '**/gulpfile.js', // gulp config
58
+ '**/gulpfile.*.js', // gulp config
59
+ '**/Gruntfile{,.js}', // grunt config
60
+ '**/protractor.conf.js', // protractor config
61
+ '**/protractor.conf.*.js', // protractor config
62
+ '**/karma.conf.js', // karma config
63
+ '**/.eslintrc.js', // eslint config
64
+ ],
65
+ optionalDependencies: false,
66
+ },
67
+ ],
68
+
69
+ // Forbid mutable exports
70
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
71
+ 'import/no-mutable-exports': 'error',
72
+
73
+ // Module systems:
74
+
75
+ // disallow require()
76
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
77
+ 'import/no-commonjs': 'off',
78
+
79
+ // disallow AMD require/define
80
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-amd.md
81
+ 'import/no-amd': 'error',
82
+
83
+ // No Node.js builtin modules
84
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
85
+ // TODO: enable?
86
+ 'import/no-nodejs-modules': 'off',
87
+
88
+ // Style guide:
89
+
90
+ // disallow non-import statements appearing before import statements
91
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md
92
+ 'import/first': 'error',
93
+
94
+ // disallow non-import statements appearing before import statements
95
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/imports-first.md
96
+ // deprecated: use `import/first`
97
+ 'import/imports-first': 'off',
98
+
99
+ // disallow duplicate imports
100
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
101
+ 'import/no-duplicates': 'error',
102
+
103
+ // disallow namespace imports
104
+ // TODO: enable?
105
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
106
+ 'import/no-namespace': 'off',
107
+
108
+ // Ensure consistent use of file extension within the import path
109
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/extensions.md
110
+ 'import/extensions': [
111
+ 'error', 'ignorePackages', {
112
+ js: 'never',
113
+ mjs: 'never',
114
+ jsx: 'never',
115
+ },
116
+ ],
117
+
118
+ // ensure absolute imports are above relative imports and that unassigned imports are ignored
119
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md
120
+ // TODO: enforce a stricter convention in module import order?
121
+ 'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
122
+
123
+ // Require a newline after the last import/require in a group
124
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
125
+ 'import/newline-after-import': 'error',
126
+
127
+ // Require modules with a single export to use a default export
128
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
129
+ 'import/prefer-default-export': 'error',
130
+
131
+ // Restrict which files can be imported in a given folder
132
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
133
+ 'import/no-restricted-paths': 'off',
134
+
135
+ // Forbid modules to have too many dependencies
136
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
137
+ 'import/max-dependencies': ['off', { max: 10 }],
138
+
139
+ // Forbid import of modules using absolute paths
140
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
141
+ 'import/no-absolute-path': 'error',
142
+
143
+ // Forbid require() calls with expressions
144
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
145
+ 'import/no-dynamic-require': 'error',
146
+
147
+ // prevent importing the submodules of other modules
148
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
149
+ 'import/no-internal-modules': [
150
+ 'off', {
151
+ allow: [],
152
+ },
153
+ ],
154
+
155
+ // Warn if a module could be mistakenly parsed as a script by a consumer
156
+ // leveraging Unambiguous JavaScript Grammar
157
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
158
+ // this should not be enabled until this proposal has at least been *presented* to TC39.
159
+ // At the moment, it's not a thing.
160
+ 'import/unambiguous': 'off',
161
+
162
+ // Forbid Webpack loader syntax in imports
163
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
164
+ 'import/no-webpack-loader-syntax': 'error',
165
+
166
+ // Prevent unassigned imports
167
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
168
+ // importing for side effects is perfectly acceptable, if you need side effects.
169
+ 'import/no-unassigned-import': 'off',
170
+
171
+ // Prevent importing the default as if it were named
172
+ // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
173
+ 'import/no-named-default': 'error',
174
+
175
+ // Reports if a module's default export is unnamed
176
+ // https://github.com/import-js/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
177
+ 'import/no-anonymous-default-export': [
178
+ 'off', {
179
+ allowArray: false,
180
+ allowArrowFunction: false,
181
+ allowAnonymousClass: false,
182
+ allowAnonymousFunction: false,
183
+ allowLiteral: false,
184
+ allowObject: false,
185
+ },
186
+ ],
187
+
188
+ // This rule enforces that all exports are declared at the bottom of the file.
189
+ // https://github.com/import-js/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md
190
+ // TODO: enable?
191
+ 'import/exports-last': 'off',
192
+
193
+ // Reports when named exports are not grouped together in a single export declaration
194
+ // or when multiple assignments to CommonJS module.exports or exports object are present
195
+ // in a single file.
196
+ // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
197
+ 'import/group-exports': 'off',
198
+
199
+ // forbid default exports. this is a terrible rule, do not use it.
200
+ // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
201
+ 'import/no-default-export': 'off',
202
+
203
+ // Prohibit named exports. this is a terrible rule, do not use it.
204
+ // https://github.com/import-js/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
205
+ 'import/no-named-export': 'off',
206
+
207
+ // Forbid a module from importing itself
208
+ // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md
209
+ 'import/no-self-import': 'error',
210
+
211
+ // Forbid cyclical dependencies between modules
212
+ // https://github.com/import-js/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md
213
+ 'import/no-cycle': ['error', { maxDepth: '∞' }],
214
+
215
+ // Ensures that there are no useless path segments
216
+ // https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md
217
+ 'import/no-useless-path-segments': ['error', { commonjs: true }],
218
+
219
+ // dynamic imports require a leading comment with a webpackChunkName
220
+ // https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md
221
+ 'import/dynamic-import-chunkname': [
222
+ 'off', {
223
+ importFunctions: [],
224
+ webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
225
+ },
226
+ ],
227
+
228
+ // Use this rule to prevent imports to folders in relative parent paths.
229
+ // https://github.com/import-js/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md
230
+ 'import/no-relative-parent-imports': 'off',
231
+
232
+ // Reports modules without any exports, or with unused exports
233
+ // https://github.com/import-js/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md
234
+ // TODO: enable once it supports CJS
235
+ 'import/no-unused-modules': [
236
+ 'off', {
237
+ ignoreExports: [],
238
+ missingExports: true,
239
+ unusedExports: true,
240
+ },
241
+ ],
242
+
243
+ // Reports the use of import declarations
244
+ // with CommonJS exports in any module except for the main module.
245
+ // https://github.com/import-js/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md
246
+ 'import/no-import-module-exports': [
247
+ 'error', {
248
+ exceptions: [],
249
+ },
250
+ ],
251
+
252
+ // Use this rule to prevent importing packages through relative paths.
253
+ // https://github.com/import-js/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-relative-packages.md
254
+ 'import/no-relative-packages': 'error',
255
+
256
+ // enforce a consistent style for type specifiers (inline or top-level)
257
+ // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/consistent-type-specifier-style.md
258
+ // TODO, semver-major: enable (just in case)
259
+ 'import/consistent-type-specifier-style': ['off', 'prefer-inline'],
260
+
261
+ // Reports the use of empty named import blocks.
262
+ // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md
263
+ // TODO, semver-minor: enable
264
+ 'import/no-empty-named-blocks': 'off',
265
+ };
@@ -1,12 +1,15 @@
1
1
  import { FlatCompat } from '@eslint/eslintrc';
2
+ // eslint-disable-next-line import/no-unresolved
3
+ import tseslint from 'typescript-eslint';
2
4
  import base from './base.js';
3
5
 
4
6
  const compat = new FlatCompat();
5
7
 
6
8
  const config = [
7
9
  ...base,
8
- ...compat.extends('plugin:@typescript-eslint/strict-type-checked'),
9
- ...compat.extends('plugin:@typescript-eslint/stylistic-type-checked'),
10
+ { '@typescript-eslint': tseslint.plugin },
11
+ ...tseslint.configs.strictTypeChecked.map(c => ({ ...c, plugins: {} })),
12
+ ...tseslint.configs.stylisticTypeChecked.map(c => ({ ...c, plugins: {} })),
10
13
  ...compat.extends('airbnb-typescript/base'),
11
14
  {
12
15
  languageOptions: {
@@ -1,6 +1,6 @@
1
1
  import svelteParser from 'svelte-eslint-parser';
2
2
  // eslint-disable-next-line import/no-unresolved
3
- import tsParser from '@typescript-eslint/parser';
3
+ import tseslint from 'typescript-eslint';
4
4
  import typescriptBrowser from './typescript-browser.js';
5
5
 
6
6
  export default [
@@ -9,7 +9,7 @@ export default [
9
9
  languageOptions: {
10
10
  parser: svelteParser,
11
11
  parserOptions: {
12
- parser: tsParser,
12
+ parser: tseslint.parser,
13
13
  project: './tsconfig.eslint.json',
14
14
  extraFileExtensions: ['.svelte'],
15
15
  },
@@ -46,10 +46,12 @@ export default [
46
46
  'svelte/no-at-html-tags': 'error',
47
47
  'svelte/no-target-blank': 'off', // use noreferrer only is ok
48
48
 
49
- 'svelte/block-lang': ['error', {
50
- script: ['ts', null],
51
- style: ['scss', null],
52
- }],
49
+ 'svelte/block-lang': [
50
+ 'error', {
51
+ script: ['ts', null],
52
+ style: ['scss', null],
53
+ },
54
+ ],
53
55
  'svelte/button-has-type': 'error',
54
56
  'svelte/no-at-debug-tags': 'warn',
55
57
  'svelte/no-immutable-reactive-statements': 'error',
package/vue3.js DELETED
@@ -1,116 +0,0 @@
1
- import { FlatCompat } from '@eslint/eslintrc';
2
- import parser from 'vue-eslint-parser';
3
- import browser from './browser.js';
4
-
5
- const compat = new FlatCompat();
6
-
7
- const config = [
8
- ...browser,
9
- ...compat.extends('plugin:vue/vue3-recommended'),
10
- {
11
- languageOptions: {
12
- parser,
13
- },
14
- rules: {
15
- 'import/no-default-export': 'off',
16
- 'vue/max-attributes-per-line': ['error', {
17
- singleline: 4,
18
- }],
19
- 'vue/html-indent': ['error', 2],
20
- 'vue/html-closing-bracket-newline': ['error', {
21
- singleline: 'never',
22
- multiline: 'never',
23
- }],
24
- // use airbnb rules in vue templates
25
- 'vue/array-bracket-spacing': 'error',
26
- 'vue/arrow-spacing': 'error',
27
- 'vue/block-spacing': 'error',
28
- 'vue/brace-style': [
29
- 'error',
30
- '1tbs',
31
- {
32
- allowSingleLine: true,
33
- },
34
- ],
35
- 'vue/camelcase': [
36
- 'error',
37
- {
38
- properties: 'never',
39
- },
40
- ],
41
- 'vue/comma-dangle': [
42
- 'error',
43
- {
44
- arrays: 'always-multiline',
45
- objects: 'always-multiline',
46
- imports: 'always-multiline',
47
- exports: 'always-multiline',
48
- functions: 'always-multiline',
49
- },
50
- ],
51
- 'vue/comma-spacing': 'error',
52
- 'vue/comma-style': [
53
- 'error',
54
- 'last',
55
- {
56
- exceptions: {
57
- ArrayExpression: false,
58
- ArrayPattern: false,
59
- ArrowFunctionExpression: false,
60
- CallExpression: false,
61
- FunctionDeclaration: false,
62
- FunctionExpression: false,
63
- ImportDeclaration: false,
64
- ObjectExpression: false,
65
- ObjectPattern: false,
66
- VariableDeclaration: false,
67
- NewExpression: false,
68
- },
69
- },
70
- ],
71
- 'vue/dot-location': [
72
- 'error',
73
- 'property',
74
- ],
75
- 'vue/dot-notation': 'error',
76
- 'vue/eqeqeq': 'error',
77
- 'vue/key-spacing': 'error',
78
- 'vue/keyword-spacing': 'error',
79
- 'vue/max-len': ['error', {
80
- code: 100,
81
- template: 100,
82
- comments: 100,
83
- ignoreUrls: true,
84
- ignoreRegExpLiterals: true,
85
- ignoreStrings: true,
86
- ignoreTemplateLiterals: true,
87
- }],
88
- 'vue/no-empty-pattern': 'error',
89
- 'vue/no-irregular-whitespace': 'error',
90
- 'vue/no-restricted-syntax': [
91
- 'error',
92
- 'ForInStatement',
93
- 'LabeledStatement',
94
- 'WithStatement',
95
- ],
96
- 'vue/no-useless-concat': 'error',
97
- 'vue/object-curly-spacing': [
98
- 'error',
99
- 'always',
100
- ],
101
- 'vue/prefer-template': 'error',
102
- 'vue/space-in-parens': 'error',
103
- 'vue/space-infix-ops': 'error',
104
- 'vue/space-unary-ops': 'error',
105
- 'vue/template-curly-spacing': 'error',
106
- },
107
- },
108
- ];
109
-
110
- // default name '.vue' is invalid processer name in flat config
111
- const vueConfig = config.find((c) => c?.plugins?.vue);
112
- if (vueConfig) {
113
- vueConfig.plugins.vue.processors.vue = vueConfig.plugins.vue.processors['.vue'];
114
- }
115
-
116
- export default [...config, { processor: 'vue/vue' }];