@codfish/eslint-config 0.0.0-PR-132--78c4c74 → 0.0.0-semantically-released
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/dist/tests/integration/eslint-execution.spec.d.ts +2 -0
- package/dist/tests/integration/eslint-execution.spec.d.ts.map +1 -0
- package/dist/tests/integration/rule-application.spec.d.ts +2 -0
- package/dist/tests/integration/rule-application.spec.d.ts.map +1 -0
- package/dist/tests/scenarios/edge-cases.spec.d.ts +2 -0
- package/dist/tests/scenarios/edge-cases.spec.d.ts.map +1 -0
- package/dist/tests/unit/config-loading.spec.d.ts +2 -0
- package/dist/tests/unit/config-loading.spec.d.ts.map +1 -0
- package/dist/tests/unit/dynamic-detection.spec.d.ts +2 -0
- package/dist/tests/unit/dynamic-detection.spec.d.ts.map +1 -0
- package/dist/tests/unit/utils.spec.d.ts +2 -0
- package/dist/tests/unit/utils.spec.d.ts.map +1 -0
- package/index.js +3 -5
- package/package.json +3 -2
- package/rules/react.js +53 -34
- package/rules/tests.js +6 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-execution.spec.d.ts","sourceRoot":"","sources":["../../../tests/integration/eslint-execution.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-application.spec.d.ts","sourceRoot":"","sources":["../../../tests/integration/rule-application.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-cases.spec.d.ts","sourceRoot":"","sources":["../../../tests/scenarios/edge-cases.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loading.spec.d.ts","sourceRoot":"","sources":["../../../tests/unit/config-loading.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-detection.spec.d.ts","sourceRoot":"","sources":["../../../tests/unit/dynamic-detection.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.spec.d.ts","sourceRoot":"","sources":["../../../tests/unit/utils.spec.js"],"names":[],"mappings":""}
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import markdown from '@eslint/markdown';
|
|
|
4
4
|
import html from '@html-eslint/eslint-plugin';
|
|
5
5
|
import htmlParser from '@html-eslint/parser';
|
|
6
6
|
import { defineConfig } from 'eslint/config';
|
|
7
|
-
import
|
|
7
|
+
import prettierConfig from 'eslint-plugin-prettier/recommended';
|
|
8
8
|
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
|
|
9
9
|
import ymlPlugin from 'eslint-plugin-yml';
|
|
10
10
|
import globals from 'globals';
|
|
@@ -294,7 +294,7 @@ export default defineConfig([
|
|
|
294
294
|
// Allow GitHub-style alerts and checkbox syntax (task lists)
|
|
295
295
|
'markdown/no-missing-label-refs': [
|
|
296
296
|
'error',
|
|
297
|
-
{ allowLabels: ['!NOTE', '!WARNING', '!IMPORTANT', '!TIP', '', 'x', 'X'] },
|
|
297
|
+
{ allowLabels: ['!NOTE', '!WARNING', '!IMPORTANT', '!TIP', '!CAUTION', '', 'x', 'X'] },
|
|
298
298
|
],
|
|
299
299
|
},
|
|
300
300
|
},
|
|
@@ -313,9 +313,7 @@ export default defineConfig([
|
|
|
313
313
|
{
|
|
314
314
|
files: ['**/*.{js,ts,jsx,tsx,md,yml,yaml,html,json,jsonc,json5}'],
|
|
315
315
|
|
|
316
|
-
|
|
317
|
-
prettier: prettierPlugin,
|
|
318
|
-
},
|
|
316
|
+
extends: [prettierConfig],
|
|
319
317
|
|
|
320
318
|
rules: {
|
|
321
319
|
// Reset prettier rule passing in custom prettier config.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codfish/eslint-config",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-semantically-released",
|
|
4
4
|
"description": "Modern ESLint configuration with TypeScript, React, and testing framework support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsc --emitDeclarationOnly",
|
|
47
47
|
"dev": "tsc --watch",
|
|
48
|
-
"
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
49
|
"lint": "eslint",
|
|
50
50
|
"format": "eslint --fix",
|
|
51
51
|
"test": "vitest",
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"typescript-eslint": "^8.44.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
85
86
|
"doctoc": "^2.2.1",
|
|
86
87
|
"eslint": "^9.35.0",
|
|
87
88
|
"husky": "^9.1.7",
|
package/rules/react.js
CHANGED
|
@@ -16,50 +16,69 @@ import { ifAnyDep } from '../utils.js';
|
|
|
16
16
|
* - https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
|
|
17
17
|
* - https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
|
|
18
18
|
*/
|
|
19
|
-
export default defineConfig(
|
|
20
|
-
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
{
|
|
21
|
+
name: 'codfish/react',
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
files: ['**/*.jsx', '**/*.tsx', '**/*.mjsx', '**/*.mtsx'],
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
extends: [
|
|
26
|
+
react.configs.flat.recommended,
|
|
27
|
+
reactHooks.configs.flat['recommended-latest'],
|
|
28
|
+
reactRefresh.configs.recommended,
|
|
29
|
+
jsxA11y.flatConfigs.recommended,
|
|
30
|
+
ifAnyDep('@tanstack/react-query', tanstackQuery.configs['flat/recommended']),
|
|
31
|
+
ifAnyDep('next', nextPlugin.configs.recommended),
|
|
32
|
+
ifAnyDep('next', nextPlugin.configs['core-web-vitals']),
|
|
33
|
+
].filter(Boolean),
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
languageOptions: {
|
|
36
|
+
globals: {
|
|
37
|
+
...globals.serviceworker,
|
|
38
|
+
...globals.browser,
|
|
39
|
+
},
|
|
38
40
|
},
|
|
39
|
-
},
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
settings: {
|
|
43
|
+
react: {
|
|
44
|
+
version: 'detect',
|
|
45
|
+
},
|
|
44
46
|
},
|
|
45
|
-
},
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
rules: {
|
|
49
|
+
// React 17+ uses automatic JSX runtime, no need to import React
|
|
50
|
+
'react/react-in-jsx-scope': 'off',
|
|
51
|
+
'react/jsx-uses-react': 'off',
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
// TypeScript provides type checking, no need for PropTypes
|
|
54
|
+
'react/prop-types': 'off',
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
// this rule is too noisey and doesn't account for certain valid use cases
|
|
57
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
// sometimes autoFocus is needed for better UX. @todo - revisit later?
|
|
60
|
+
'jsx-a11y/no-autofocus': 'off',
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
...ifAnyDep('@tanstack/react-query', { '@tanstack/query/exhaustive-deps': 'error' }, {}),
|
|
65
|
+
|
|
66
|
+
...ifAnyDep(
|
|
67
|
+
'next',
|
|
68
|
+
{
|
|
69
|
+
// annoying cause this is common in Next.js, i.e. generateMetadata()
|
|
70
|
+
'react-refresh/only-export-components': ['off'],
|
|
71
|
+
},
|
|
72
|
+
{},
|
|
73
|
+
),
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
{
|
|
78
|
+
name: 'codfish/react-next-config',
|
|
79
|
+
files: ['next.config.js', 'next.config.ts'],
|
|
80
|
+
rules: {
|
|
81
|
+
'require-await': 'off',
|
|
82
|
+
},
|
|
64
83
|
},
|
|
65
|
-
|
|
84
|
+
]);
|
package/rules/tests.js
CHANGED
|
@@ -30,8 +30,12 @@ export default defineConfig({
|
|
|
30
30
|
extends: [
|
|
31
31
|
ifAnyDep('jest', jest.configs['flat/recommended'], false),
|
|
32
32
|
ifAnyDep('vitest', vitest.configs.recommended, false),
|
|
33
|
-
ifAnyDep('
|
|
34
|
-
ifAnyDep('
|
|
33
|
+
ifAnyDep('@testing-library/dom', testingLibrary.configs['flat/dom'], false),
|
|
34
|
+
ifAnyDep('@testing-library/react', testingLibrary.configs['flat/react'], false),
|
|
35
|
+
ifAnyDep('@testing-library/vue', testingLibrary.configs['flat/vue'], false),
|
|
36
|
+
ifAnyDep('@testing-library/svelte', testingLibrary.configs['flat/svelte'], false),
|
|
37
|
+
ifAnyDep('@testing-library/angular', testingLibrary.configs['flat/angular'], false),
|
|
38
|
+
ifAnyDep('@testing-library/marko', testingLibrary.configs['flat/marko'], false),
|
|
35
39
|
].filter(Boolean),
|
|
36
40
|
|
|
37
41
|
languageOptions: {
|