@ntnyq/eslint-config 2.0.0-beta.4 → 2.0.0-beta.6

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,8 +1,8 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.4",
5
- "packageManager": "pnpm@8.1.1",
4
+ "version": "2.0.0-beta.6",
5
+ "packageManager": "pnpm@8.2.0",
6
6
  "description": "",
7
7
  "keywords": [],
8
8
  "license": "MIT",
@@ -10,17 +10,12 @@
10
10
  "name": "ntnyq",
11
11
  "email": "ntnyq13@gmail.com"
12
12
  },
13
- "main": "./index.js",
14
- "module": "./index.js",
15
- "types": "./index.d.ts",
16
- "exports": {
17
- "types": "./index.d.ts",
18
- "require": "./index.js",
19
- "import": "./index.js"
20
- },
13
+ "exports": "./dist/index.js",
14
+ "main": "./dist/index.js",
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
21
17
  "files": [
22
- "index.js",
23
- "lib"
18
+ "dist"
24
19
  ],
25
20
  "publishConfig": {
26
21
  "access": "public"
@@ -29,11 +24,12 @@
29
24
  "eslint": "^8.30.0"
30
25
  },
31
26
  "dependencies": {
32
- "@eslint/js": "^8.37.0",
33
- "@typescript-eslint/eslint-plugin": "^5.57.1",
34
- "@typescript-eslint/parser": "^5.57.1",
35
- "astro-eslint-parser": "^0.13.2",
27
+ "@eslint/js": "^8.38.0",
28
+ "@typescript-eslint/eslint-plugin": "^5.58.0",
29
+ "@typescript-eslint/parser": "^5.58.0",
30
+ "astro-eslint-parser": "^0.13.3",
36
31
  "eslint-config-prettier": "^8.8.0",
32
+ "eslint-define-config": "^1.17.0",
37
33
  "eslint-plugin-astro": "^0.26.1",
38
34
  "eslint-plugin-eslint-comments": "^3.2.0",
39
35
  "eslint-plugin-import": "^2.27.5",
@@ -54,18 +50,24 @@
54
50
  "@ntnyq/prettier-config": "^1.6.1",
55
51
  "@types/node": "^18.15.11",
56
52
  "bumpp": "^9.1.0",
57
- "eslint": "^8.37.0",
58
- "eslint-define-config": "^1.17.0",
53
+ "eslint": "^8.38.0",
59
54
  "husky": "^8.0.3",
60
55
  "nano-staged": "^0.8.0",
61
- "typescript": "5.0.3"
56
+ "pnpm": "^8.2.0",
57
+ "tsup": "^6.7.0",
58
+ "typescript": "5.0.4"
62
59
  },
63
60
  "engines": {
64
61
  "node": ">=16.14.0"
65
62
  },
66
63
  "prettier": "@ntnyq/prettier-config",
64
+ "nano-staged": {
65
+ "*.{js,ts,json,jsonc,md,yaml,yml}": "pnpm run lint --fix"
66
+ },
67
67
  "scripts": {
68
- "lint": "eslint .",
68
+ "build": "tsup",
69
+ "lint": "ESLINT_USE_FLAT_CONFIG=true eslint .",
70
+ "postinstall": "pnpm run build",
69
71
  "release": "bumpp && pnpm publish --tag next"
70
72
  }
71
73
  }
package/index.js DELETED
@@ -1,11 +0,0 @@
1
- export * from './lib/js.js'
2
- export * from './lib/ts.js'
3
- export * from './lib/yml.js'
4
- export * from './lib/vue.js'
5
- export * from './lib/astro.js'
6
- export * from './lib/jsonc.js'
7
- export * from './lib/prettier.js'
8
- export * from './lib/markdown.js'
9
- export * from './lib/eslint-comments.js'
10
-
11
- export * from './lib/presets.js'
package/lib/astro.js DELETED
@@ -1,23 +0,0 @@
1
- import astroPlugin, { configs } from 'eslint-plugin-astro'
2
- import astroParser from 'astro-eslint-parser'
3
- import { GLOB_ASTRO } from './shared.js'
4
-
5
- /** @type {import('eslint-define-config').FlatESLintConfig[]} */
6
- export const astro = [
7
- {
8
- files: [GLOB_ASTRO],
9
- plugins: {
10
- astro: astroPlugin,
11
- },
12
- languageOptions: {
13
- parser: astroParser,
14
- parserOptions: {
15
- parser: '@typescript-eslint/parser',
16
- extraFileExtensions: ['.astro'],
17
- },
18
- },
19
- rules: {
20
- ...configs.recommended,
21
- },
22
- },
23
- ]
@@ -1,14 +0,0 @@
1
- import commentsPlugin from 'eslint-plugin-eslint-comments'
2
-
3
- /** @type {import('eslint-define-config').FlatESLintConfig[]} */
4
- export const eslintComments = [
5
- {
6
- plugins: {
7
- 'eslint-comments': commentsPlugin,
8
- },
9
- rules: {
10
- ...commentsPlugin.configs.recommended.rules,
11
- 'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
12
- },
13
- },
14
- ]
package/lib/js.js DELETED
@@ -1,497 +0,0 @@
1
- import globals from 'globals'
2
- import jsConfig from '@eslint/js'
3
- import importPlugin from 'eslint-plugin-import'
4
- import unicornPlugin from 'eslint-plugin-unicorn'
5
-
6
- /** @type {import('eslint-define-config').FlatESLintConfig[]} */
7
- export const js = [
8
- jsConfig.configs.recommended,
9
- {
10
- languageOptions: {
11
- globals: {
12
- ...globals.browser,
13
- ...globals.es2021,
14
- ...globals.node,
15
- },
16
- sourceType: 'module',
17
- },
18
-
19
- rules: {
20
- // standard v 17.0.0
21
- 'accessor-pairs': ['error', { setWithoutGet: true, enforceForClassMembers: true }],
22
- 'array-bracket-spacing': ['error', 'never'],
23
- 'arrow-spacing': ['error', { before: true, after: true }],
24
- 'block-spacing': ['error', 'always'],
25
- 'brace-style': ['error', '1tbs', { allowSingleLine: true }],
26
- camelcase: [
27
- 'error',
28
- {
29
- allow: ['^UNSAFE_'],
30
- properties: 'never',
31
- ignoreGlobals: true,
32
- },
33
- ],
34
- 'comma-spacing': ['error', { before: false, after: true }],
35
- 'comma-style': ['error', 'last'],
36
- 'computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
37
- 'constructor-super': 'error',
38
- curly: ['error', 'multi-line'],
39
- 'default-case-last': 'error',
40
- 'dot-location': ['error', 'property'],
41
- 'dot-notation': ['error', { allowKeywords: true }],
42
- 'eol-last': 'error',
43
- 'func-call-spacing': ['error', 'never'],
44
- indent: [
45
- 'error',
46
- 2,
47
- {
48
- SwitchCase: 1,
49
- VariableDeclarator: 1,
50
- outerIIFEBody: 1,
51
- MemberExpression: 1,
52
- FunctionDeclaration: { parameters: 1, body: 1 },
53
- FunctionExpression: { parameters: 1, body: 1 },
54
- CallExpression: { arguments: 1 },
55
- ArrayExpression: 1,
56
- ObjectExpression: 1,
57
- ImportDeclaration: 1,
58
- flatTernaryExpressions: false,
59
- ignoreComments: false,
60
- ignoredNodes: [
61
- 'TemplateLiteral *',
62
- 'JSXElement',
63
- 'JSXElement > *',
64
- 'JSXAttribute',
65
- 'JSXIdentifier',
66
- 'JSXNamespacedName',
67
- 'JSXMemberExpression',
68
- 'JSXSpreadAttribute',
69
- 'JSXExpressionContainer',
70
- 'JSXOpeningElement',
71
- 'JSXClosingElement',
72
- 'JSXFragment',
73
- 'JSXOpeningFragment',
74
- 'JSXClosingFragment',
75
- 'JSXText',
76
- 'JSXEmptyExpression',
77
- 'JSXSpreadChild',
78
- ],
79
- offsetTernaryExpressions: true,
80
- },
81
- ],
82
- 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
83
- 'keyword-spacing': ['error', { before: true, after: true }],
84
- 'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
85
- 'multiline-ternary': ['error', 'always-multiline'],
86
- 'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
87
- 'new-parens': 'error',
88
- 'no-array-constructor': 'error',
89
- 'no-async-promise-executor': 'error',
90
- 'no-caller': 'error',
91
- 'no-class-assign': 'error',
92
- 'no-compare-neg-zero': 'error',
93
- 'no-cond-assign': 'error',
94
- 'no-const-assign': 'error',
95
- 'no-constant-condition': ['error', { checkLoops: false }],
96
- 'no-control-regex': 'error',
97
- 'no-debugger': 'error',
98
- 'no-delete-var': 'error',
99
- 'no-dupe-args': 'error',
100
- 'no-dupe-class-members': 'error',
101
- 'no-dupe-keys': 'error',
102
- 'no-duplicate-case': 'error',
103
- 'no-useless-backreference': 'error',
104
- 'no-empty': ['error', { allowEmptyCatch: true }],
105
- 'no-empty-character-class': 'error',
106
- 'no-empty-pattern': 'error',
107
- 'no-eval': 'error',
108
- 'no-ex-assign': 'error',
109
- 'no-extend-native': 'error',
110
- 'no-extra-bind': 'error',
111
- 'no-extra-boolean-cast': 'error',
112
- 'no-extra-parens': ['error', 'functions'],
113
- 'no-fallthrough': 'error',
114
- 'no-floating-decimal': 'error',
115
- 'no-func-assign': 'error',
116
- 'no-global-assign': 'error',
117
- 'no-implied-eval': 'error',
118
- 'no-import-assign': 'error',
119
- 'no-invalid-regexp': 'error',
120
- 'no-irregular-whitespace': 'error',
121
- 'no-iterator': 'error',
122
- 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
123
- 'no-lone-blocks': 'error',
124
- 'no-loss-of-precision': 'error',
125
- 'no-misleading-character-class': 'error',
126
- 'no-prototype-builtins': 'error',
127
- 'no-useless-catch': 'error',
128
- 'no-mixed-operators': [
129
- 'error',
130
- {
131
- groups: [
132
- ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
133
- ['&&', '||'],
134
- ['in', 'instanceof'],
135
- ],
136
- allowSamePrecedence: true,
137
- },
138
- ],
139
- 'no-mixed-spaces-and-tabs': 'error',
140
- 'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
141
- 'no-new': 'error',
142
- 'no-new-func': 'error',
143
- 'no-new-object': 'error',
144
- 'no-new-symbol': 'error',
145
- 'no-new-wrappers': 'error',
146
- 'no-obj-calls': 'error',
147
- 'no-octal': 'error',
148
- 'no-octal-escape': 'error',
149
- 'no-proto': 'error',
150
- 'no-redeclare': ['error', { builtinGlobals: false }],
151
- 'no-regex-spaces': 'error',
152
- 'no-self-assign': ['error', { props: true }],
153
- 'no-self-compare': 'error',
154
- 'no-sequences': 'error',
155
- 'no-shadow-restricted-names': 'error',
156
- 'no-sparse-arrays': 'error',
157
- 'no-tabs': 'error',
158
- 'no-template-curly-in-string': 'error',
159
- 'no-this-before-super': 'error',
160
- 'no-throw-literal': 'error',
161
- 'no-trailing-spaces': 'error',
162
- 'no-undef': 'error',
163
- 'no-undef-init': 'error',
164
- 'no-unexpected-multiline': 'error',
165
- 'no-unmodified-loop-condition': 'error',
166
- 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
167
- 'no-unreachable': 'error',
168
- 'no-unreachable-loop': 'error',
169
- 'no-unsafe-finally': 'error',
170
- 'no-unsafe-negation': 'error',
171
- 'no-unused-expressions': [
172
- 'error',
173
- {
174
- allowShortCircuit: true,
175
- allowTernary: true,
176
- allowTaggedTemplates: true,
177
- },
178
- ],
179
- 'no-unused-vars': [
180
- 'error',
181
- {
182
- args: 'none',
183
- caughtErrors: 'none',
184
- ignoreRestSiblings: true,
185
- vars: 'all',
186
- },
187
- ],
188
- 'no-useless-call': 'error',
189
- 'no-useless-computed-key': 'error',
190
- 'no-useless-constructor': 'error',
191
- 'no-useless-rename': 'error',
192
- 'no-useless-return': 'error',
193
- 'no-whitespace-before-property': 'error',
194
- 'object-curly-newline': ['error', { multiline: true, consistent: true }],
195
- 'object-curly-spacing': ['error', 'always'],
196
- 'object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
197
- 'padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
198
- 'prefer-promise-reject-errors': 'error',
199
- 'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
200
- 'quote-props': ['error', 'as-needed'],
201
- 'rest-spread-spacing': ['error', 'never'],
202
- semi: ['error', 'never'],
203
- 'semi-spacing': ['error', { before: false, after: true }],
204
- 'space-before-blocks': ['error', 'always'],
205
- 'space-before-function-paren': ['error', 'always'],
206
- 'space-in-parens': ['error', 'never'],
207
- 'space-infix-ops': 'error',
208
- 'space-unary-ops': ['error', { words: true, nonwords: false }],
209
- 'symbol-description': 'error',
210
- 'template-tag-spacing': ['error', 'never'],
211
- 'unicode-bom': ['error', 'never'],
212
- 'use-isnan': [
213
- 'error',
214
- {
215
- enforceForSwitchCase: true,
216
- enforceForIndexOf: true,
217
- },
218
- ],
219
- 'valid-typeof': ['error', { requireStringLiterals: true }],
220
- 'wrap-iife': ['error', 'any', { functionPrototypeMethods: true }],
221
- 'yield-star-spacing': ['error', 'both'],
222
- yoda: ['error', 'never'],
223
-
224
- // es6+
225
- 'no-var': 'error',
226
- 'prefer-rest-params': 'error',
227
- 'prefer-spread': 'error',
228
- 'prefer-template': 'error',
229
- 'template-curly-spacing': 'error',
230
- 'generator-star-spacing': 'off',
231
- 'no-empty-static-block': 'error',
232
- 'no-new-native-nonconstructor': 'error',
233
- 'arrow-parens': [
234
- 'error',
235
- 'as-needed',
236
- {
237
- requireForBlockBody: false,
238
- },
239
- ],
240
- quotes: [
241
- 'error',
242
- 'single',
243
- {
244
- avoidEscape: true,
245
- allowTemplateLiterals: false,
246
- },
247
- ],
248
- 'prefer-const': [
249
- 'error',
250
- {
251
- destructuring: 'all',
252
- ignoreReadBeforeAssign: true,
253
- },
254
- ],
255
- 'prefer-arrow-callback': [
256
- 'error',
257
- {
258
- allowNamedFunctions: false,
259
- allowUnboundThis: true,
260
- },
261
- ],
262
- 'object-shorthand': [
263
- 'error',
264
- 'always',
265
- {
266
- ignoreConstructors: false,
267
- avoidQuotes: true,
268
- },
269
- ],
270
- 'spaced-comment': [
271
- 'error',
272
- 'always',
273
- {
274
- line: {
275
- markers: ['/'],
276
- exceptions: ['/', '#'],
277
- },
278
- block: {
279
- markers: ['!'],
280
- exceptions: ['*'],
281
- balanced: true,
282
- },
283
- },
284
- ],
285
-
286
- // best-practice
287
- eqeqeq: ['error', 'smart'],
288
- complexity: ['error', { max: 30 }],
289
- 'array-callback-return': 'error',
290
- 'block-scoped-var': 'error',
291
- 'consistent-return': 'off',
292
- 'no-alert': 'error',
293
- 'no-case-declarations': 'error',
294
- 'no-multi-spaces': 'error',
295
- 'no-multi-str': 'error',
296
- 'no-with': 'error',
297
- 'no-void': 'error',
298
- 'no-useless-escape': 'off',
299
- 'vars-on-top': 'error',
300
- 'require-await': 'off',
301
- 'no-return-assign': 'off',
302
- 'one-var': ['error', 'never'],
303
- 'operator-linebreak': ['error', 'before'],
304
- 'comma-dangle': ['error', 'always-multiline'],
305
- 'max-params': ['error', { max: 5 }],
306
- 'max-depth': ['error', { max: 5 }],
307
- 'max-nested-callbacks': ['error', { max: 10 }],
308
- 'max-statements-per-line': ['error', { max: 2 }],
309
- 'max-lines': [
310
- 'error',
311
- {
312
- max: 1000,
313
- skipComments: true,
314
- skipBlankLines: true,
315
- },
316
- ],
317
- 'max-lines-per-function': [
318
- 'error',
319
- {
320
- max: 100,
321
- skipComments: true,
322
- skipBlankLines: true,
323
- },
324
- ],
325
- 'no-use-before-define': [
326
- 'error',
327
- {
328
- functions: false,
329
- classes: false,
330
- variables: true,
331
- },
332
- ],
333
- 'max-len': [
334
- 'error',
335
- {
336
- code: 200,
337
- tabWidth: 2,
338
- comments: 200,
339
- ignoreUrls: true,
340
- ignoreStrings: true,
341
- ignoreRegExpLiterals: true,
342
- ignoreTemplateLiterals: true,
343
- ignoreTrailingComments: true,
344
- },
345
- ],
346
- 'sort-imports': [
347
- 'error',
348
- {
349
- ignoreCase: false,
350
- ignoreDeclarationSort: true,
351
- ignoreMemberSort: false,
352
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
353
- allowSeparatedGroups: false,
354
- },
355
- ],
356
- },
357
- },
358
-
359
- {
360
- files: ['**/scripts/*', '**/cli.*'],
361
- rules: {
362
- 'no-console': 'off',
363
- },
364
- },
365
-
366
- {
367
- files: ['**/*.{test,spec}.js?(x)'],
368
- rules: {
369
- 'no-unused-expressions': 'off',
370
- 'max-lines-per-function': 'off',
371
- },
372
- },
373
- ]
374
-
375
- /** @type {import('eslint-define-config').FlatESLintConfig[]} */
376
- export const jsx = [
377
- {
378
- files: ['**/*.jsx'],
379
- languageOptions: {
380
- parserOptions: {
381
- ecmaFeatures: {
382
- jsx: true,
383
- },
384
- },
385
- },
386
- },
387
- ]
388
-
389
- /** @type {import('eslint-define-config').FlatESLintConfig[]} */
390
- export const imports = [
391
- {
392
- plugins: {
393
- import: importPlugin,
394
- },
395
- settings: {
396
- 'import/resolver': {
397
- node: { extensions: ['.js', '.mjs', '.ts', '.mts', '.d.ts'] },
398
- },
399
- },
400
- rules: {
401
- 'import/no-unresolved': 'off',
402
- 'import/no-absolute-path': 'off',
403
- 'import/no-named-as-default-member': 'off',
404
-
405
- 'import/newline-after-import': 'error',
406
- 'import/first': 'error',
407
- 'import/no-mutable-exports': 'error',
408
- 'import/no-duplicates': 'error',
409
- 'import/order': [
410
- 'error',
411
- {
412
- groups: [
413
- 'builtin',
414
- 'external',
415
- 'internal',
416
- 'parent',
417
- 'sibling',
418
- 'index',
419
- 'object',
420
- 'type',
421
- ],
422
- 'newlines-between': 'never',
423
- pathGroups: [{ pattern: '@/**', group: 'internal' }],
424
- pathGroupsExcludedImportTypes: ['type'],
425
- },
426
- ],
427
- },
428
- },
429
- ]
430
-
431
- /** @type {import('eslint-define-config').FlatESLintConfig[]} */
432
- export const unicorn = [
433
- {
434
- plugins: {
435
- unicorn: unicornPlugin,
436
- },
437
- rules: {
438
- 'unicorn/no-unsafe-regex': 'off',
439
-
440
- 'unicorn/error-message': 'error',
441
- 'unicorn/escape-case': 'error',
442
- 'unicorn/no-new-buffer': 'error',
443
- 'unicorn/number-literal-case': 'error',
444
- 'unicorn/prefer-includes': 'error',
445
- 'unicorn/prefer-type-error': 'error',
446
- 'unicorn/throw-new-error': 'error',
447
- 'unicorn/no-unnecessary-await': 'error',
448
- 'unicorn/switch-case-braces': ['error', 'avoid'],
449
- 'unicorn/no-typeof-undefined': 'error',
450
- 'unicorn/prefer-set-size': 'error',
451
- 'unicorn/better-regex': 'error',
452
- 'unicorn/custom-error-definition': 'error',
453
- 'unicorn/explicit-length-check': 'error',
454
- 'unicorn/new-for-builtins': 'error',
455
- 'unicorn/no-console-spaces': 'error',
456
- 'unicorn/no-for-loop': 'error',
457
- 'unicorn/no-hex-escape': 'error',
458
- 'unicorn/no-lonely-if': 'error',
459
- 'unicorn/prefer-keyboard-event-key': 'error',
460
- 'unicorn/prefer-math-trunc': 'error',
461
- 'unicorn/prefer-negative-index': 'error',
462
- 'unicorn/prefer-node-protocol': 'error',
463
- 'unicorn/prefer-number-properties': 'error',
464
- 'unicorn/prefer-optional-catch-binding': 'error',
465
- 'unicorn/prefer-prototype-methods': 'error',
466
- 'unicorn/prefer-reflect-apply': 'error',
467
-
468
- 'unicorn/prefer-date-now': 'error',
469
-
470
- // String
471
- 'unicorn/prefer-string-slice': 'error',
472
- 'unicorn/prefer-string-trim-start-end': 'error',
473
- 'unicorn/prefer-string-starts-ends-with': 'error',
474
-
475
- // DOM
476
- 'unicorn/prefer-add-event-listener': 'error',
477
- 'unicorn/no-invalid-remove-event-listener': 'error',
478
- 'unicorn/prefer-query-selector': 'error',
479
- 'unicorn/prefer-modern-dom-apis': 'error',
480
- 'unicorn/prefer-dom-node-append': 'error',
481
- 'unicorn/prefer-dom-node-dataset': 'error',
482
- 'unicorn/prefer-dom-node-remove': 'error',
483
- 'unicorn/prefer-dom-node-text-content': 'error',
484
-
485
- // Array
486
- 'unicorn/no-new-array': 'error',
487
- 'unicorn/no-instanceof-array': 'error',
488
- 'unicorn/no-array-push-push': 'error',
489
- 'unicorn/no-array-callback-reference': 'error',
490
- 'unicorn/no-array-method-this-argument': 'error',
491
- 'unicorn/prefer-array-find': 'error',
492
- 'unicorn/prefer-array-some': 'error',
493
- 'unicorn/prefer-array-flat-map': 'error',
494
- 'unicorn/prefer-array-index-of': 'error',
495
- },
496
- },
497
- ]