@lincy/eslint-config 1.1.7 → 2.0.0

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/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  module.exports = {
2
- extends: ['./vue'],
2
+ extends: [
3
+ '@lincy/eslint-config-vue',
4
+ ],
3
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
- "version": "1.1.7",
3
+ "version": "2.0.0",
4
4
  "packageManager": "pnpm@8.4.0",
5
5
  "description": "LinCenYing's ESLint config",
6
6
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
@@ -11,12 +11,7 @@
11
11
  ],
12
12
  "main": "index.js",
13
13
  "files": [
14
- "index.js",
15
- "vue.js",
16
- "vue2.js",
17
- "ts.js",
18
- "basic.js",
19
- "standard.js"
14
+ "index.js"
20
15
  ],
21
16
  "peerDependencies": {
22
17
  "eslint": ">=7.4.0"
@@ -24,39 +19,20 @@
24
19
  "dependencies": {
25
20
  "@typescript-eslint/eslint-plugin": "^5.59.7",
26
21
  "@typescript-eslint/parser": "^5.59.7",
27
- "eslint-config-prettier": "^8.6.0",
28
- "eslint-plugin-antfu": "^0.39.3",
29
22
  "eslint-plugin-eslint-comments": "^3.2.0",
30
23
  "eslint-plugin-html": "^7.1.0",
31
24
  "eslint-plugin-import": "^2.27.5",
32
- "eslint-plugin-jest": "^27.2.1",
33
25
  "eslint-plugin-jsonc": "^2.8.0",
34
- "eslint-plugin-markdown": "^3.0.0",
35
26
  "eslint-plugin-n": "^16.0.0",
36
- "eslint-plugin-no-only-tests": "^3.1.0",
37
- "eslint-plugin-prettier": "^4.2.1",
38
27
  "eslint-plugin-promise": "^6.1.1",
39
28
  "eslint-plugin-unicorn": "^47.0.0",
40
- "eslint-plugin-unused-imports": "^2.0.0",
41
29
  "eslint-plugin-vue": "^9.14.0",
42
30
  "eslint-plugin-yml": "^1.7.0",
43
31
  "jsonc-eslint-parser": "^2.3.0",
44
- "local-pkg": "^0.4.3",
45
- "yaml-eslint-parser": "^1.2.2"
32
+ "yaml-eslint-parser": "^1.2.2",
33
+ "@lincy/eslint-config-vue": "2.0.0"
46
34
  },
47
35
  "devDependencies": {
48
- "@babel/eslint-parser": "^7.21.8",
49
- "eslint": "^8.41.0",
50
- "typescript": "^5.0.4"
51
- },
52
- "publishConfig": {
53
- "registry": "https://registry.npmjs.org/"
54
- },
55
- "pnpm": {
56
- "peerDependencyRules": {
57
- "ignoreMissing": [
58
- "prettier"
59
- ]
60
- }
36
+ "eslint": "^8.41.0"
61
37
  }
62
- }
38
+ }
package/README.md DELETED
@@ -1,21 +0,0 @@
1
- # @lincy/eslint-config
2
-
3
- A set of opinionated ESLint (http://eslint.org) rules (all rules included) tailored for Vue.js projects
4
-
5
- 如果依赖安装了 typescript, 则自动应用 ts 的规则
6
- 如果依赖安装了 prettier, 则自动应用 prettier 的规则
7
-
8
- Usage
9
-
10
- - pnpm install -D eslint @lincy/eslint-config
11
- - create a file named .eslintrc in your project:
12
- ```
13
- {
14
- "extends": "@lincy"
15
- // Your overrides...
16
- }
17
- ```
18
-
19
- License
20
-
21
- MIT
package/basic.js DELETED
@@ -1,379 +0,0 @@
1
- module.exports = {
2
- env: {
3
- es6: true,
4
- browser: true,
5
- node: true,
6
- },
7
- reportUnusedDisableDirectives: true,
8
- extends: [
9
- './standard',
10
- 'plugin:import/recommended',
11
- 'plugin:eslint-comments/recommended',
12
- 'plugin:jsonc/recommended-with-jsonc',
13
- 'plugin:yml/standard',
14
- 'plugin:markdown/recommended',
15
- ],
16
- ignorePatterns: [
17
- '*.min.*',
18
- '*.d.ts',
19
- 'CHANGELOG.md',
20
- 'dist',
21
- 'LICENSE*',
22
- 'output',
23
- 'out',
24
- 'coverage',
25
- 'public',
26
- 'temp',
27
- 'package-lock.json',
28
- 'pnpm-lock.yaml',
29
- 'yarn.lock',
30
- '__snapshots__',
31
- // ignore for in lint-staged
32
- '*.css',
33
- '*.png',
34
- '*.ico',
35
- '*.toml',
36
- '*.patch',
37
- '*.txt',
38
- '*.crt',
39
- '*.key',
40
- 'Dockerfile',
41
- // force include
42
- '!.github',
43
- '!.vitepress',
44
- '!.vscode',
45
- ],
46
- plugins: [
47
- 'html',
48
- 'unicorn',
49
- 'antfu',
50
- 'no-only-tests',
51
- 'unused-imports',
52
- ],
53
- settings: {
54
- 'import/resolver': {
55
- node: { extensions: ['.js', '.mjs'] },
56
- },
57
- },
58
- overrides: [
59
- {
60
- files: ['*.json', '*.json5', '*.jsonc'],
61
- parser: 'jsonc-eslint-parser',
62
- rules: {
63
- 'jsonc/array-bracket-spacing': ['error', 'never'],
64
- 'jsonc/comma-dangle': ['error', 'never'],
65
- 'jsonc/comma-style': ['error', 'last'],
66
- 'jsonc/indent': ['error', 2],
67
- 'jsonc/key-spacing': ['error', { beforeColon: false, afterColon: true }],
68
- 'jsonc/no-octal-escape': 'error',
69
- 'jsonc/object-curly-newline': ['error', { multiline: true, consistent: true }],
70
- 'jsonc/object-curly-spacing': ['error', 'always'],
71
- 'jsonc/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
72
- },
73
- },
74
- {
75
- files: ['*.yaml', '*.yml'],
76
- parser: 'yaml-eslint-parser',
77
- rules: {
78
- 'spaced-comment': 'off',
79
- },
80
- },
81
- {
82
- files: ['package.json'],
83
- parser: 'jsonc-eslint-parser',
84
- rules: {
85
- 'jsonc/sort-keys': [
86
- 'error',
87
- {
88
- pathPattern: '^$',
89
- order: [
90
- 'publisher',
91
- 'name',
92
- 'displayName',
93
- 'type',
94
- 'version',
95
- 'private',
96
- 'packageManager',
97
- 'description',
98
- 'author',
99
- 'license',
100
- 'funding',
101
- 'homepage',
102
- 'repository',
103
- 'bugs',
104
- 'keywords',
105
- 'categories',
106
- 'sideEffects',
107
- 'exports',
108
- 'main',
109
- 'module',
110
- 'unpkg',
111
- 'jsdelivr',
112
- 'types',
113
- 'typesVersions',
114
- 'bin',
115
- 'icon',
116
- 'files',
117
- 'engines',
118
- 'activationEvents',
119
- 'contributes',
120
- 'scripts',
121
- 'peerDependencies',
122
- 'peerDependenciesMeta',
123
- 'dependencies',
124
- 'optionalDependencies',
125
- 'devDependencies',
126
- 'pnpm',
127
- 'overrides',
128
- 'resolutions',
129
- 'husky',
130
- 'simple-git-hooks',
131
- 'lint-staged',
132
- 'eslintConfig',
133
- ],
134
- },
135
- {
136
- pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies$',
137
- order: { type: 'asc' },
138
- },
139
- {
140
- pathPattern: '^exports.*$',
141
- order: [
142
- 'types',
143
- 'require',
144
- 'import',
145
- ],
146
- },
147
- ],
148
- },
149
- },
150
- {
151
- files: ['*.d.ts'],
152
- rules: {
153
- 'import/no-duplicates': 'off',
154
- },
155
- },
156
- {
157
- files: ['*.js', '*.cjs', '*.jsx'],
158
- rules: {
159
- '@typescript-eslint/no-var-requires': 'off',
160
- '@typescript-eslint/no-require-imports': 'off',
161
- },
162
- },
163
- {
164
- files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
165
- rules: {
166
- 'no-void': ['error', { allowAsStatement: true }],
167
- },
168
- },
169
- {
170
- files: ['scripts/**/*.*', 'cli.*'],
171
- rules: {
172
- 'no-console': 'off',
173
- },
174
- },
175
- {
176
- files: ['*.test.ts', '*.test.js', '*.spec.ts', '*.spec.js'],
177
- rules: {
178
- 'no-unused-expressions': 'off',
179
- 'no-only-tests/no-only-tests': 'error',
180
- },
181
- },
182
- {
183
- // Code blocks in markdown file
184
- files: ['**/*.md/*.*'],
185
- rules: {
186
- '@typescript-eslint/no-redeclare': 'off',
187
- '@typescript-eslint/no-unused-vars': 'off',
188
- '@typescript-eslint/no-use-before-define': 'off',
189
- '@typescript-eslint/no-var-requires': 'off',
190
- '@typescript-eslint/comma-dangle': 'off',
191
- '@typescript-eslint/consistent-type-imports': 'off',
192
- 'import/no-unresolved': 'off',
193
- 'unused-imports/no-unused-imports': 'off',
194
- 'unused-imports/no-unused-vars': 'off',
195
- 'no-alert': 'off',
196
- 'no-console': 'off',
197
- 'no-restricted-imports': 'off',
198
- 'no-undef': 'off',
199
- 'no-unused-expressions': 'off',
200
- 'no-unused-vars': 'off',
201
- 'antfu/no-cjs-exports': 'off',
202
- 'antfu/no-ts-export-equal': 'off',
203
- },
204
- },
205
- ],
206
- rules: {
207
- // import
208
- 'import/order': 'error',
209
- 'import/first': 'error',
210
- 'import/no-mutable-exports': 'error',
211
- 'import/no-unresolved': 'off',
212
- 'import/no-absolute-path': 'off',
213
- 'import/newline-after-import': ['error', { count: 1, considerComments: true }],
214
-
215
- // Common
216
- 'semi': ['error', 'never'],
217
- 'curly': ['error', 'multi-or-nest', 'consistent'],
218
- 'quotes': ['error', 'single'],
219
- 'quote-props': ['error', 'consistent-as-needed'],
220
-
221
- 'unused-imports/no-unused-imports': 'error',
222
- 'unused-imports/no-unused-vars': [
223
- 'warn',
224
- {
225
- vars: 'all',
226
- varsIgnorePattern: '^_',
227
- args: 'after-used',
228
- argsIgnorePattern: '^_',
229
- },
230
- ],
231
-
232
- 'no-param-reassign': 'off',
233
- 'array-bracket-spacing': ['error', 'never'],
234
- 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
235
- 'block-spacing': ['error', 'always'],
236
- 'camelcase': 'off',
237
- 'comma-spacing': ['error', { before: false, after: true }],
238
- 'comma-style': ['error', 'last'],
239
- 'comma-dangle': ['error', 'always-multiline'],
240
- 'no-constant-condition': 'warn',
241
- 'no-debugger': 'error',
242
- // 'no-console': ['error', { allow: ['warn', 'error'] }],
243
- 'no-console': 'off',
244
- 'no-cond-assign': ['error', 'always'],
245
- 'func-call-spacing': ['off', 'never'],
246
- 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
247
- 'indent': ['error', 4, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }],
248
- 'no-restricted-syntax': [
249
- 'error',
250
- 'DebuggerStatement',
251
- 'LabeledStatement',
252
- 'WithStatement',
253
- ],
254
- 'object-curly-spacing': ['error', 'always'],
255
- 'no-return-await': 'off',
256
- 'space-before-function-paren': [
257
- 'error',
258
- {
259
- anonymous: 'always',
260
- named: 'never',
261
- asyncArrow: 'always',
262
- },
263
- ],
264
-
265
- // es6
266
- 'no-var': 'error',
267
- 'prefer-const': [
268
- 'error',
269
- {
270
- destructuring: 'all',
271
- ignoreReadBeforeAssign: true,
272
- },
273
- ],
274
- 'prefer-arrow-callback': [
275
- 'error',
276
- {
277
- allowNamedFunctions: false,
278
- allowUnboundThis: true,
279
- },
280
- ],
281
- 'object-shorthand': [
282
- 'error',
283
- 'always',
284
- {
285
- ignoreConstructors: false,
286
- avoidQuotes: true,
287
- },
288
- ],
289
- 'prefer-exponentiation-operator': 'error',
290
- 'prefer-rest-params': 'error',
291
- 'prefer-spread': 'error',
292
- 'prefer-template': 'error',
293
- 'template-curly-spacing': 'error',
294
- 'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
295
- 'generator-star-spacing': 'off',
296
- 'spaced-comment': ['error', 'always', {
297
- line: {
298
- markers: ['/'],
299
- exceptions: ['/', '#'],
300
- },
301
- block: {
302
- markers: ['!'],
303
- exceptions: ['*'],
304
- balanced: true,
305
- },
306
- }],
307
-
308
- // best-practice
309
- 'array-callback-return': 'error',
310
- 'block-scoped-var': 'error',
311
- 'consistent-return': 'off',
312
- 'complexity': ['off', 11],
313
- 'eqeqeq': ['error', 'smart'],
314
- 'no-alert': 'warn',
315
- 'no-case-declarations': 'error',
316
- 'no-multi-spaces': 'error',
317
- 'no-multi-str': 'error',
318
- 'no-with': 'error',
319
- 'no-void': 'error',
320
- 'no-useless-escape': 'off',
321
- 'vars-on-top': 'error',
322
- 'require-await': 'off',
323
- 'no-return-assign': 'off',
324
- 'operator-linebreak': ['error', 'before'],
325
- 'max-statements-per-line': ['error', { max: 1 }],
326
-
327
- // unicorns
328
- // Pass error message when throwing errors
329
- 'unicorn/error-message': 'error',
330
- // Uppercase regex escapes
331
- 'unicorn/escape-case': 'error',
332
- // Array.isArray instead of instanceof
333
- 'unicorn/no-instanceof-array': 'error',
334
- // Prevent deprecated `new Buffer()`
335
- 'unicorn/no-new-buffer': 'error',
336
- // Keep regex literals safe!
337
- 'unicorn/no-unsafe-regex': 'off',
338
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
339
- 'unicorn/number-literal-case': 'error',
340
- // includes over indexOf when checking for existence
341
- 'unicorn/prefer-includes': 'error',
342
- // String methods startsWith/endsWith instead of more complicated stuff
343
- 'unicorn/prefer-string-starts-ends-with': 'error',
344
- // textContent instead of innerText
345
- 'unicorn/prefer-text-content': 'error',
346
- // Enforce throwing type error when throwing error while checking typeof
347
- 'unicorn/prefer-type-error': 'error',
348
- // Use new when throwing error
349
- 'unicorn/throw-new-error': 'error',
350
- // Prefer using the node: protocol
351
- 'unicorn/prefer-node-protocol': 'error',
352
-
353
- 'no-use-before-define': ['error', { functions: false, classes: false, variables: true }],
354
- 'eslint-comments/disable-enable-pair': 'off',
355
- 'import/no-named-as-default-member': 'off',
356
- 'import/no-named-as-default': 'off',
357
- 'import/namespace': 'off',
358
- 'n/no-callback-literal': 'off',
359
-
360
- 'sort-imports': [
361
- 'error',
362
- {
363
- ignoreCase: false,
364
- ignoreDeclarationSort: true,
365
- ignoreMemberSort: false,
366
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
367
- allowSeparatedGroups: false,
368
- },
369
- ],
370
-
371
- // yml
372
- 'yml/quotes': ['error', { prefer: 'single', avoidEscape: false }],
373
- 'yml/no-empty-document': 'off',
374
-
375
- 'antfu/if-newline': 'error',
376
- 'antfu/import-dedupe': 'error',
377
- 'antfu/top-level-function': 'error',
378
- },
379
- }
package/standard.js DELETED
@@ -1,243 +0,0 @@
1
- // Inline from https://github.com/standard/eslint-config-standard/blob/master/.eslintrc.json
2
- // Until it upgrades
3
-
4
- module.exports = {
5
- parserOptions: {
6
- ecmaVersion: 2022,
7
- ecmaFeatures: {
8
- jsx: true,
9
- },
10
- sourceType: 'module',
11
- },
12
- env: {
13
- es2021: true,
14
- node: true,
15
- },
16
- plugins: ['import', 'n', 'promise'],
17
- globals: {
18
- document: 'readonly',
19
- navigator: 'readonly',
20
- window: 'readonly',
21
- },
22
- rules: {
23
- 'no-var': 'warn',
24
- 'object-shorthand': ['warn', 'properties'],
25
-
26
- 'accessor-pairs': ['error', { setWithoutGet: true, enforceForClassMembers: true }],
27
- 'array-bracket-spacing': ['error', 'never'],
28
- 'array-callback-return': ['error', {
29
- allowImplicit: false,
30
- checkForEach: false,
31
- }],
32
- 'arrow-spacing': ['error', { before: true, after: true }],
33
- 'block-spacing': ['error', 'always'],
34
- 'brace-style': ['error', '1tbs', { allowSingleLine: true }],
35
- 'camelcase': ['error', {
36
- allow: ['^UNSAFE_'],
37
- properties: 'never',
38
- ignoreGlobals: true,
39
- }],
40
- 'comma-dangle': ['error', {
41
- arrays: 'never',
42
- objects: 'never',
43
- imports: 'never',
44
- exports: 'never',
45
- functions: 'never',
46
- }],
47
- 'comma-spacing': ['error', { before: false, after: true }],
48
- 'comma-style': ['error', 'last'],
49
- 'computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
50
- 'constructor-super': 'error',
51
- 'curly': ['error', 'multi-line'],
52
- 'default-case-last': 'error',
53
- 'dot-location': ['error', 'property'],
54
- 'dot-notation': ['error', { allowKeywords: true }],
55
- 'eol-last': 'error',
56
- 'eqeqeq': ['error', 'always', { null: 'ignore' }],
57
- 'func-call-spacing': ['error', 'never'],
58
- 'generator-star-spacing': ['error', { before: true, after: true }],
59
- 'indent': ['error', 4, {
60
- SwitchCase: 1,
61
- VariableDeclarator: 1,
62
- outerIIFEBody: 1,
63
- MemberExpression: 1,
64
- FunctionDeclaration: { parameters: 1, body: 1 },
65
- FunctionExpression: { parameters: 1, body: 1 },
66
- CallExpression: { arguments: 1 },
67
- ArrayExpression: 1,
68
- ObjectExpression: 1,
69
- ImportDeclaration: 1,
70
- flatTernaryExpressions: false,
71
- ignoreComments: false,
72
- ignoredNodes: ['TemplateLiteral *', 'JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXFragment', 'JSXOpeningFragment', 'JSXClosingFragment', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
73
- offsetTernaryExpressions: true,
74
- }],
75
- 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
76
- 'keyword-spacing': ['error', { before: true, after: true }],
77
- 'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
78
- 'multiline-ternary': ['error', 'always-multiline'],
79
- 'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
80
- 'new-parens': 'error',
81
- 'no-array-constructor': 'error',
82
- 'no-async-promise-executor': 'error',
83
- 'no-caller': 'error',
84
- 'no-case-declarations': 'error',
85
- 'no-class-assign': 'error',
86
- 'no-compare-neg-zero': 'error',
87
- 'no-cond-assign': 'error',
88
- 'no-const-assign': 'error',
89
- 'no-constant-condition': ['error', { checkLoops: false }],
90
- 'no-control-regex': 'error',
91
- 'no-debugger': 'error',
92
- 'no-delete-var': 'error',
93
- 'no-dupe-args': 'error',
94
- 'no-dupe-class-members': 'error',
95
- 'no-dupe-keys': 'error',
96
- 'no-duplicate-case': 'error',
97
- 'no-useless-backreference': 'error',
98
- 'no-empty': ['error', { allowEmptyCatch: true }],
99
- 'no-empty-character-class': 'error',
100
- 'no-empty-pattern': 'error',
101
- 'no-eval': 'error',
102
- 'no-ex-assign': 'error',
103
- 'no-extend-native': 'error',
104
- 'no-extra-bind': 'error',
105
- 'no-extra-boolean-cast': 'error',
106
- 'no-extra-parens': ['error', 'functions'],
107
- 'no-fallthrough': 'error',
108
- 'no-floating-decimal': 'error',
109
- 'no-func-assign': 'error',
110
- 'no-global-assign': 'error',
111
- 'no-implied-eval': 'error',
112
- 'no-import-assign': 'error',
113
- 'no-invalid-regexp': 'error',
114
- 'no-irregular-whitespace': 'error',
115
- 'no-iterator': 'error',
116
- 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
117
- 'no-lone-blocks': 'error',
118
- 'no-loss-of-precision': 'error',
119
- 'no-misleading-character-class': 'error',
120
- 'no-prototype-builtins': 'error',
121
- 'no-useless-catch': 'error',
122
- 'no-mixed-operators': ['error', {
123
- groups: [
124
- ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
125
- ['&&', '||', '?:'],
126
- ['in', 'instanceof'],
127
- ],
128
- allowSamePrecedence: true,
129
- }],
130
- 'no-mixed-spaces-and-tabs': 'error',
131
- 'no-multi-spaces': 'error',
132
- 'no-multi-str': 'error',
133
- 'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
134
- 'no-new': 'error',
135
- 'no-new-func': 'error',
136
- 'no-new-object': 'error',
137
- 'no-new-symbol': 'error',
138
- 'no-new-wrappers': 'error',
139
- 'no-obj-calls': 'error',
140
- 'no-octal': 'error',
141
- 'no-octal-escape': 'error',
142
- 'no-proto': 'error',
143
- 'no-redeclare': ['error', { builtinGlobals: false }],
144
- 'no-regex-spaces': 'error',
145
- 'no-return-assign': ['error', 'except-parens'],
146
- 'no-self-assign': ['error', { props: true }],
147
- 'no-self-compare': 'error',
148
- 'no-sequences': 'error',
149
- 'no-shadow-restricted-names': 'error',
150
- 'no-sparse-arrays': 'error',
151
- 'no-tabs': 'error',
152
- 'no-template-curly-in-string': 'error',
153
- 'no-this-before-super': 'error',
154
- 'no-throw-literal': 'error',
155
- 'no-trailing-spaces': 'error',
156
- 'no-undef': 'error',
157
- 'no-undef-init': 'error',
158
- 'no-unexpected-multiline': 'error',
159
- 'no-unmodified-loop-condition': 'error',
160
- 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
161
- 'no-unreachable': 'error',
162
- 'no-unreachable-loop': 'error',
163
- 'no-unsafe-finally': 'error',
164
- 'no-unsafe-negation': 'error',
165
- 'no-unused-expressions': ['error', {
166
- allowShortCircuit: true,
167
- allowTernary: true,
168
- allowTaggedTemplates: true,
169
- }],
170
- 'no-unused-vars': ['error', {
171
- args: 'none',
172
- caughtErrors: 'none',
173
- ignoreRestSiblings: true,
174
- vars: 'all',
175
- }],
176
- 'no-use-before-define': ['error', { functions: false, classes: false, variables: false }],
177
- 'no-useless-call': 'error',
178
- 'no-useless-computed-key': 'error',
179
- 'no-useless-constructor': 'error',
180
- 'no-useless-escape': 'error',
181
- 'no-useless-rename': 'error',
182
- 'no-useless-return': 'error',
183
- 'no-void': 'error',
184
- 'no-whitespace-before-property': 'error',
185
- 'no-with': 'error',
186
- 'object-curly-newline': ['error', { multiline: true, consistent: true }],
187
- 'object-curly-spacing': ['error', 'always'],
188
- 'object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
189
- 'one-var': ['error', { initialized: 'never' }],
190
- 'operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before', '|>': 'before' } }],
191
- 'padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
192
- 'prefer-const': ['error', { destructuring: 'all' }],
193
- 'prefer-promise-reject-errors': 'error',
194
- 'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
195
- 'quote-props': ['error', 'as-needed'],
196
- 'quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
197
- 'rest-spread-spacing': ['error', 'never'],
198
- 'semi': ['error', 'never'],
199
- 'semi-spacing': ['error', { before: false, after: true }],
200
- 'space-before-blocks': ['error', 'always'],
201
- 'space-before-function-paren': ['error', 'always'],
202
- 'space-in-parens': ['error', 'never'],
203
- 'space-infix-ops': 'error',
204
- 'space-unary-ops': ['error', { words: true, nonwords: false }],
205
- 'spaced-comment': ['error', 'always', {
206
- line: { markers: ['*package', '!', '/', ',', '='] },
207
- block: {
208
- balanced: true,
209
- markers: ['*package', '!', ',', ':', '::', 'flow-include'],
210
- exceptions: ['*'],
211
- },
212
- }],
213
- 'symbol-description': 'error',
214
- 'template-curly-spacing': ['error', 'never'],
215
- 'template-tag-spacing': ['error', 'never'],
216
- 'unicode-bom': ['error', 'never'],
217
- 'use-isnan': ['error', {
218
- enforceForSwitchCase: true,
219
- enforceForIndexOf: true,
220
- }],
221
- 'valid-typeof': ['error', { requireStringLiterals: true }],
222
- 'wrap-iife': ['error', 'any', { functionPrototypeMethods: true }],
223
- 'yield-star-spacing': ['error', 'both'],
224
- 'yoda': ['error', 'never'],
225
-
226
- 'import/export': 'error',
227
- 'import/first': 'error',
228
- 'import/no-absolute-path': ['error', { esmodule: true, commonjs: true, amd: false }],
229
- 'import/no-duplicates': 'error',
230
- 'import/no-named-default': 'error',
231
- 'import/no-webpack-loader-syntax': 'error',
232
-
233
- 'n/handle-callback-err': ['error', '^(err|error)$'],
234
- 'n/no-callback-literal': 'error',
235
- 'n/no-deprecated-api': 'error',
236
- 'n/no-exports-assign': 'error',
237
- 'n/no-new-require': 'error',
238
- 'n/no-path-concat': 'error',
239
- 'n/process-exit-as-throw': 'error',
240
-
241
- 'promise/param-names': 'error',
242
- },
243
- }
package/ts.js DELETED
@@ -1,186 +0,0 @@
1
- const fs = require('node:fs')
2
- const { join } = require('node:path')
3
- const basic = require('./basic')
4
-
5
- const tsconfig = process.env.ESLINT_TSCONFIG || 'tsconfig.eslint.json'
6
-
7
- module.exports = {
8
- extends: [
9
- './basic',
10
- 'plugin:import/typescript',
11
- 'plugin:@typescript-eslint/recommended',
12
- ],
13
- settings: {
14
- 'import/resolver': {
15
- node: {
16
- extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.d.ts'],
17
- },
18
- },
19
- },
20
- overrides: basic.overrides.concat(
21
- !fs.existsSync(join(process.cwd(), tsconfig))
22
- ? []
23
- : [{
24
- parserOptions: {
25
- tsconfigRootDir: process.cwd(),
26
- project: [tsconfig],
27
- },
28
- parser: '@typescript-eslint/parser',
29
- excludedFiles: ['**/*.md/*.*'],
30
- files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
31
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts
32
- rules: {
33
- 'no-throw-literal': 'off',
34
- '@typescript-eslint/no-throw-literal': 'error',
35
- 'no-implied-eval': 'off',
36
- '@typescript-eslint/no-implied-eval': 'error',
37
- 'dot-notation': 'off',
38
- '@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
39
- '@typescript-eslint/no-floating-promises': 'error',
40
- '@typescript-eslint/no-misused-promises': 'error',
41
- '@typescript-eslint/await-thenable': 'error',
42
- '@typescript-eslint/no-for-in-array': 'error',
43
- '@typescript-eslint/no-unnecessary-type-assertion': 'error',
44
- '@typescript-eslint/no-unsafe-argument': 'error',
45
- '@typescript-eslint/no-unsafe-assignment': 'error',
46
- '@typescript-eslint/no-unsafe-call': 'error',
47
- '@typescript-eslint/no-unsafe-member-access': 'error',
48
- '@typescript-eslint/no-unsafe-return': 'error',
49
- 'require-await': 'off',
50
- '@typescript-eslint/require-await': 'error',
51
- '@typescript-eslint/restrict-plus-operands': 'error',
52
- '@typescript-eslint/restrict-template-expressions': 'error',
53
- '@typescript-eslint/unbound-method': 'error',
54
- },
55
- },
56
- {
57
- // https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md
58
- files: [
59
- '**/__tests__/**/*.ts',
60
- '**/*.spec.ts',
61
- '**/*.test.ts',
62
- ],
63
- plugins: ['jest'],
64
- rules: {
65
- // you should turn the original rule off *only* for test files
66
- '@typescript-eslint/unbound-method': 'off',
67
- 'jest/unbound-method': 'error',
68
- },
69
- }],
70
- ),
71
- rules: {
72
- 'import/named': 'off',
73
-
74
- // TS
75
- '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
76
- '@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],
77
- '@typescript-eslint/type-annotation-spacing': ['error', {}],
78
- '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports', disallowTypeAnnotations: false }],
79
- '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
80
- '@typescript-eslint/prefer-ts-expect-error': 'error',
81
- '@typescript-eslint/no-require-imports': 'error',
82
-
83
- // Override JS
84
- 'no-useless-constructor': 'off',
85
- 'indent': 'off',
86
- '@typescript-eslint/indent': ['error', 4, {
87
- SwitchCase: 1,
88
- VariableDeclarator: 1,
89
- outerIIFEBody: 1,
90
- MemberExpression: 1,
91
- FunctionDeclaration: { parameters: 1, body: 1 },
92
- FunctionExpression: { parameters: 1, body: 1 },
93
- CallExpression: { arguments: 1 },
94
- ArrayExpression: 1,
95
- ObjectExpression: 1,
96
- ImportDeclaration: 1,
97
- flatTernaryExpressions: false,
98
- ignoreComments: false,
99
- ignoredNodes: [
100
- 'TemplateLiteral *',
101
- 'JSXElement',
102
- 'JSXElement > *',
103
- 'JSXAttribute',
104
- 'JSXIdentifier',
105
- 'JSXNamespacedName',
106
- 'JSXMemberExpression',
107
- 'JSXSpreadAttribute',
108
- 'JSXExpressionContainer',
109
- 'JSXOpeningElement',
110
- 'JSXClosingElement',
111
- 'JSXFragment',
112
- 'JSXOpeningFragment',
113
- 'JSXClosingFragment',
114
- 'JSXText',
115
- 'JSXEmptyExpression',
116
- 'JSXSpreadChild',
117
- 'TSTypeParameterInstantiation',
118
- 'FunctionExpression > .params[decorators.length > 0]',
119
- 'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
120
- 'ClassBody.body > PropertyDefinition[decorators.length > 0] > .key',
121
- ],
122
- offsetTernaryExpressions: true,
123
- }],
124
- 'no-redeclare': 'off',
125
- '@typescript-eslint/no-redeclare': 'error',
126
- 'no-use-before-define': 'off',
127
- '@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false, variables: true }],
128
- 'brace-style': 'off',
129
- '@typescript-eslint/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
130
- 'comma-dangle': 'off',
131
- '@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
132
- 'object-curly-spacing': 'off',
133
- '@typescript-eslint/object-curly-spacing': ['error', 'always'],
134
- 'semi': 'off',
135
- '@typescript-eslint/semi': ['error', 'never'],
136
- 'quotes': 'off',
137
- '@typescript-eslint/quotes': ['error', 'single'],
138
- 'space-before-blocks': 'off',
139
- '@typescript-eslint/space-before-blocks': ['error', 'always'],
140
- 'space-before-function-paren': 'off',
141
- '@typescript-eslint/space-before-function-paren': [
142
- 'error',
143
- {
144
- anonymous: 'always',
145
- named: 'never',
146
- asyncArrow: 'always',
147
- },
148
- ],
149
- 'space-infix-ops': 'off',
150
- '@typescript-eslint/space-infix-ops': 'error',
151
- 'keyword-spacing': 'off',
152
- '@typescript-eslint/keyword-spacing': ['error', { before: true, after: true }],
153
- 'comma-spacing': 'off',
154
- '@typescript-eslint/comma-spacing': ['error', { before: false, after: true }],
155
- 'no-extra-parens': 'off',
156
- '@typescript-eslint/no-extra-parens': ['error', 'functions'],
157
- 'no-dupe-class-members': 'off',
158
- '@typescript-eslint/no-dupe-class-members': 'error',
159
- 'no-loss-of-precision': 'off',
160
- '@typescript-eslint/no-loss-of-precision': 'error',
161
- 'lines-between-class-members': 'off',
162
- '@typescript-eslint/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
163
-
164
- 'antfu/generic-spacing': 'error',
165
- 'antfu/no-cjs-exports': 'error',
166
- 'antfu/no-ts-export-equal': 'error',
167
-
168
- // off
169
- '@typescript-eslint/consistent-indexed-object-style': 'off',
170
- '@typescript-eslint/naming-convention': 'off',
171
- '@typescript-eslint/explicit-function-return-type': 'off',
172
- '@typescript-eslint/explicit-member-accessibility': 'off',
173
- '@typescript-eslint/no-explicit-any': 'off',
174
- '@typescript-eslint/parameter-properties': 'off',
175
- '@typescript-eslint/no-empty-interface': 'off',
176
- '@typescript-eslint/ban-ts-ignore': 'off',
177
- '@typescript-eslint/no-empty-function': 'off',
178
- '@typescript-eslint/no-non-null-assertion': 'off',
179
- '@typescript-eslint/explicit-module-boundary-types': 'off',
180
- '@typescript-eslint/ban-types': 'off',
181
- // '@typescript-eslint/no-namespace': 'off',
182
- '@typescript-eslint/triple-slash-reference': 'off',
183
- // handled by unused-imports/no-unused-imports
184
- '@typescript-eslint/no-unused-vars': 'off',
185
- },
186
- }
package/vue.js DELETED
@@ -1,122 +0,0 @@
1
- const { isPackageExists } = require('local-pkg')
2
-
3
- const TS = isPackageExists('typescript')
4
- const Prettier = isPackageExists('prettier')
5
-
6
- if (!TS) {
7
- console.warn(
8
- '[@lincy/eslint-config] TypeScript is not installed, fallback to JS only.',
9
- )
10
- }
11
-
12
- module.exports = {
13
- overrides: [
14
- {
15
- files: ['*.vue'],
16
- parser: 'vue-eslint-parser',
17
- parserOptions: {
18
- parser: '@typescript-eslint/parser',
19
- },
20
- rules: {
21
- 'no-unused-vars': 'off',
22
- 'no-undef': 'off',
23
- ...(TS ? { '@typescript-eslint/no-unused-vars': 'off' } : null),
24
- },
25
- },
26
- ],
27
- extends: [
28
- 'plugin:vue/vue3-recommended',
29
- TS ? './ts' : './basic',
30
- ...(Prettier ? ['prettier'] : []),
31
- ],
32
- plugins: [
33
- ...(Prettier ? ['prettier'] : []),
34
- ],
35
- rules: {
36
-
37
- 'vue/max-attributes-per-line': 'off',
38
- 'vue/no-v-html': 'off',
39
- 'vue/require-prop-types': 'off',
40
- 'vue/require-default-prop': 'off',
41
- 'vue/multi-word-component-names': 'off',
42
- 'vue/prefer-import-from-vue': 'off',
43
- 'vue/no-v-text-v-html-on-component': 'off',
44
- 'vue/no-dupe-keys': 'off',
45
-
46
- // reactivity transform
47
- 'vue/no-setup-props-destructure': 'off',
48
-
49
- 'vue/component-tags-order': ['error', {
50
- order: ['template', 'script', 'style'],
51
- }],
52
- 'vue/block-tag-newline': ['error', {
53
- singleline: 'always',
54
- multiline: 'always',
55
- }],
56
- 'vue/component-name-in-template-casing': ['error', 'PascalCase'],
57
- 'vue/component-options-name-casing': ['error', 'PascalCase'],
58
- 'vue/custom-event-name-casing': ['error', 'camelCase'],
59
- 'vue/define-macros-order': ['error', {
60
- order: ['defineProps', 'defineEmits'],
61
- }],
62
- 'vue/html-indent': ['error', 4, {
63
- attribute: 1,
64
- baseIndent: 1,
65
- closeBracket: 0,
66
- alignAttributesVertically: true,
67
- ignores: [],
68
- }],
69
- 'vue/html-comment-content-spacing': ['error', 'always', {
70
- exceptions: ['-'],
71
- }],
72
- 'vue/no-restricted-v-bind': ['error', '/^v-/'],
73
- 'vue/no-useless-v-bind': 'error',
74
- 'vue/no-unused-refs': 'error',
75
- 'vue/padding-line-between-blocks': ['error', 'always'],
76
- 'vue/prefer-separate-static-class': 'error',
77
-
78
- // extensions
79
- 'vue/array-bracket-spacing': ['error', 'never'],
80
- 'vue/arrow-spacing': ['error', { before: true, after: true }],
81
- 'vue/block-spacing': ['error', 'always'],
82
- 'vue/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
83
- 'vue/comma-dangle': ['error', 'always-multiline'],
84
- 'vue/comma-spacing': ['error', { before: false, after: true }],
85
- 'vue/comma-style': ['error', 'last'],
86
- 'vue/dot-location': ['error', 'property'],
87
- 'vue/dot-notation': ['error', { allowKeywords: true }],
88
- 'vue/eqeqeq': ['error', 'smart'],
89
- // 'vue/func-call-spacing': ['off', 'never'],
90
- 'vue/key-spacing': ['error', { beforeColon: false, afterColon: true }],
91
- 'vue/keyword-spacing': ['error', { before: true, after: true }],
92
- 'vue/no-constant-condition': 'warn',
93
- 'vue/no-empty-pattern': 'error',
94
- 'vue/no-extra-parens': ['error', 'functions'],
95
- 'vue/no-irregular-whitespace': 'error',
96
- 'vue/no-loss-of-precision': 'error',
97
- 'vue/no-restricted-syntax': [
98
- 'error',
99
- 'DebuggerStatement',
100
- 'LabeledStatement',
101
- 'WithStatement',
102
- ],
103
- 'vue/no-sparse-arrays': 'error',
104
- 'vue/object-curly-newline': ['error', { multiline: true, consistent: true }],
105
- 'vue/object-curly-spacing': ['error', 'always'],
106
- 'vue/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
107
- 'vue/object-shorthand': ['error', 'always', {
108
- ignoreConstructors: false,
109
- avoidQuotes: true,
110
- }],
111
- 'vue/operator-linebreak': ['error', 'before'],
112
- 'vue/prefer-template': 'error',
113
- 'vue/quote-props': ['error', 'consistent-as-needed'],
114
- 'vue/space-in-parens': ['error', 'never'],
115
- 'vue/space-infix-ops': 'error',
116
- 'vue/space-unary-ops': ['error', { words: true, nonwords: false }],
117
- 'vue/template-curly-spacing': 'error',
118
- 'vue/singleline-html-element-content-newline': 'off',
119
-
120
- ...(Prettier ? { 'prettier/prettier': 'error' } : null),
121
- },
122
- }
package/vue2.js DELETED
@@ -1,112 +0,0 @@
1
- const { isPackageExists } = require('local-pkg')
2
-
3
- const Prettier = isPackageExists('prettier')
4
-
5
- module.exports = {
6
- overrides: [
7
- {
8
- files: ['*.vue'],
9
- parser: 'vue-eslint-parser',
10
- parserOptions: {
11
- parser: '@babel/eslint-parser',
12
- },
13
- rules: {
14
- 'no-unused-vars': 'off',
15
- 'no-undef': 'off',
16
- },
17
- },
18
- ],
19
- extends: [
20
- 'plugin:vue/recommended',
21
- './basic',
22
- ...(Prettier ? ['prettier'] : []),
23
- ],
24
- plugins: [
25
- ...(Prettier ? ['prettier'] : []),
26
- ],
27
- rules: {
28
- 'vue/max-attributes-per-line': 'off',
29
- 'vue/no-v-html': 'off',
30
- 'vue/require-prop-types': 'off',
31
- 'vue/require-default-prop': 'off',
32
- 'vue/multi-word-component-names': 'off',
33
- 'vue/prefer-import-from-vue': 'off',
34
- 'vue/no-v-text-v-html-on-component': 'off',
35
-
36
- // reactivity transform
37
- 'vue/no-setup-props-destructure': 'off',
38
-
39
- 'vue/component-tags-order': ['error', {
40
- order: ['template', 'script', 'style'],
41
- }],
42
- 'vue/block-tag-newline': ['error', {
43
- singleline: 'always',
44
- multiline: 'always',
45
- }],
46
- 'vue/component-name-in-template-casing': ['error', 'PascalCase'],
47
- 'vue/component-options-name-casing': ['error', 'PascalCase'],
48
- 'vue/custom-event-name-casing': ['error', 'kebab-case'],
49
- 'vue/define-macros-order': ['error', {
50
- order: ['defineProps', 'defineEmits'],
51
- }],
52
- 'vue/html-indent': ['error', 4, {
53
- attribute: 1,
54
- baseIndent: 1,
55
- closeBracket: 0,
56
- alignAttributesVertically: true,
57
- ignores: [],
58
- }],
59
- 'vue/html-comment-content-spacing': ['error', 'always', {
60
- exceptions: ['-'],
61
- }],
62
- 'vue/no-restricted-v-bind': ['error', '/^v-/'],
63
- 'vue/no-useless-v-bind': 'error',
64
- 'vue/no-unused-refs': 'error',
65
- 'vue/padding-line-between-blocks': ['error', 'always'],
66
- 'vue/prefer-separate-static-class': 'error',
67
-
68
- // extensions
69
- 'vue/array-bracket-spacing': ['error', 'never'],
70
- 'vue/arrow-spacing': ['error', { before: true, after: true }],
71
- 'vue/block-spacing': ['error', 'always'],
72
- 'vue/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
73
- 'vue/comma-dangle': ['error', 'always-multiline'],
74
- 'vue/comma-spacing': ['error', { before: false, after: true }],
75
- 'vue/comma-style': ['error', 'last'],
76
- 'vue/dot-location': ['error', 'property'],
77
- 'vue/dot-notation': ['error', { allowKeywords: true }],
78
- 'vue/eqeqeq': ['error', 'smart'],
79
- // 'vue/func-call-spacing': ['off', 'never'],
80
- 'vue/key-spacing': ['error', { beforeColon: false, afterColon: true }],
81
- 'vue/keyword-spacing': ['error', { before: true, after: true }],
82
- 'vue/no-constant-condition': 'warn',
83
- 'vue/no-empty-pattern': 'error',
84
- 'vue/no-extra-parens': ['error', 'functions'],
85
- 'vue/no-irregular-whitespace': 'error',
86
- 'vue/no-loss-of-precision': 'error',
87
- 'vue/no-restricted-syntax': [
88
- 'error',
89
- 'DebuggerStatement',
90
- 'LabeledStatement',
91
- 'WithStatement',
92
- ],
93
- 'vue/no-sparse-arrays': 'error',
94
- 'vue/object-curly-newline': ['error', { multiline: true, consistent: true }],
95
- 'vue/object-curly-spacing': ['error', 'always'],
96
- 'vue/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
97
- 'vue/object-shorthand': ['error', 'always', {
98
- ignoreConstructors: false,
99
- avoidQuotes: true,
100
- }],
101
- 'vue/operator-linebreak': ['error', 'before'],
102
- 'vue/prefer-template': 'error',
103
- 'vue/quote-props': ['error', 'consistent-as-needed'],
104
- 'vue/space-in-parens': ['error', 'never'],
105
- 'vue/space-infix-ops': 'error',
106
- 'vue/space-unary-ops': ['error', { words: true, nonwords: false }],
107
- 'vue/template-curly-spacing': 'error',
108
- 'vue/singleline-html-element-content-newline': 'off',
109
-
110
- ...(Prettier ? { 'prettier/prettier': 'error' } : null),
111
- },
112
- }