@jabworks/eslint-plugin 1.0.6 → 1.1.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/CHANGELOG.md +7 -0
- package/package.json +60 -46
- package/src/configs/base.js +38 -36
- package/src/configs/next.js +71 -69
- package/src/index.js +12 -12
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,64 +1,78 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"name": "@jabworks/eslint-plugin",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"private": false,
|
|
3
5
|
"description": "Opinionated ESLint plugin and flat config for JS, TS, React, and Next.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"eslint",
|
|
8
|
+
"eslint-config",
|
|
9
|
+
"eslint-plugin",
|
|
10
|
+
"eslintplugin",
|
|
11
|
+
"typescript",
|
|
12
|
+
"typescript-eslint"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/jabworks/style-guide/tree/main/packages/eslint-plugin#readme",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/jabworks/style-guide.git",
|
|
18
|
+
"directory": "packages/eslint-plugin"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Vi Minh Hiếu <jabworks@hieuvi.dev> (https://hieuvi.dev)",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./src/types/index.d.ts",
|
|
26
|
+
"import": "./src/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"main": "./src/index.js",
|
|
30
|
+
"types": "./src/types/index.d.ts",
|
|
4
31
|
"dependencies": {
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"@
|
|
9
|
-
"@
|
|
10
|
-
"@
|
|
11
|
-
"eslint": "^
|
|
32
|
+
"globals": "^17.2.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
|
|
36
|
+
"@eslint/js": "^9.39.2",
|
|
37
|
+
"@next/eslint-plugin-next": "^16.1.6",
|
|
38
|
+
"@stylistic/eslint-plugin": "^5.7.1",
|
|
39
|
+
"@types/node": "^25.1.0",
|
|
40
|
+
"@vitest/eslint-plugin": "^1.6.6",
|
|
41
|
+
"eslint": "^9.39.2",
|
|
12
42
|
"eslint-config-prettier": "^10.1.8",
|
|
13
43
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
14
44
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
15
45
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
16
46
|
"eslint-plugin-import": "^2.32.0",
|
|
17
|
-
"eslint-plugin-jest": "^29.
|
|
47
|
+
"eslint-plugin-jest": "^29.12.1",
|
|
18
48
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
19
|
-
"eslint-plugin-playwright": "^2.
|
|
49
|
+
"eslint-plugin-playwright": "^2.5.1",
|
|
20
50
|
"eslint-plugin-react": "^7.37.5",
|
|
21
|
-
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
22
51
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
23
52
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
24
|
-
"eslint-plugin-testing-library": "^7.
|
|
25
|
-
"eslint-plugin-turbo": "^2.
|
|
53
|
+
"eslint-plugin-testing-library": "^7.15.4",
|
|
54
|
+
"eslint-plugin-turbo": "^2.8.0",
|
|
26
55
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
27
|
-
"globals": "^16.5.0",
|
|
28
56
|
"typescript": "^5.9.3",
|
|
29
|
-
"typescript-eslint": "^8.
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
57
|
+
"typescript-eslint": "^8.54.0",
|
|
32
58
|
"@jabworks/typescript-config": "0.0.0"
|
|
33
59
|
},
|
|
34
|
-
"exports": {
|
|
35
|
-
".": {
|
|
36
|
-
"import": "./src/index.js",
|
|
37
|
-
"types": "./src/types/index.d.ts"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"homepage": "https://github.com/hieu1871998/style-guide/tree/main/packages/eslint-plugin",
|
|
41
|
-
"keywords": [
|
|
42
|
-
"eslint",
|
|
43
|
-
"eslint-config",
|
|
44
|
-
"eslint-plugin",
|
|
45
|
-
"eslintplugin",
|
|
46
|
-
"typescript",
|
|
47
|
-
"typescript-eslint"
|
|
48
|
-
],
|
|
49
|
-
"main": "./src/index.js",
|
|
50
|
-
"name": "@jabworks/eslint-plugin",
|
|
51
|
-
"private": false,
|
|
52
|
-
"repository": {
|
|
53
|
-
"type": "git",
|
|
54
|
-
"url": "https://github.com/hieu1871998/style-guide/tree/main/packages/eslint-plugin"
|
|
55
|
-
},
|
|
56
|
-
"type": "module",
|
|
57
|
-
"types": "./src/types/index.d.ts",
|
|
58
60
|
"peerDependencies": {
|
|
59
|
-
"eslint": ">=
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
"@eslint-community/eslint-plugin-eslint-comments": ">=4.6.0",
|
|
62
|
+
"@next/eslint-plugin-next": ">=16.1.6",
|
|
63
|
+
"@vitest/eslint-plugin": ">=1.6.6",
|
|
64
|
+
"eslint": ">=9.39.2",
|
|
65
|
+
"eslint-plugin-import": ">=2.32.0",
|
|
66
|
+
"eslint-plugin-jest": ">=29.12.1",
|
|
67
|
+
"eslint-plugin-jsx-a11y": ">=6.10.2",
|
|
68
|
+
"eslint-plugin-playwright": ">=2.5.1",
|
|
69
|
+
"eslint-plugin-react": ">=7.37.5",
|
|
70
|
+
"eslint-plugin-react-hooks": ">=7.0.1",
|
|
71
|
+
"eslint-plugin-simple-import-sort": ">=12.1.1",
|
|
72
|
+
"eslint-plugin-testing-library": ">=7.13.5",
|
|
73
|
+
"eslint-plugin-turbo": ">=2.8.0",
|
|
74
|
+
"eslint-plugin-unicorn": ">=62.0.0",
|
|
75
|
+
"typescript": ">=5.9.3",
|
|
76
|
+
"typescript-eslint": ">=8.54.0"
|
|
77
|
+
}
|
|
64
78
|
}
|
package/src/configs/base.js
CHANGED
|
@@ -15,46 +15,48 @@ import comments from './comments.js';
|
|
|
15
15
|
|
|
16
16
|
/** @type {import('eslint').Linter.Config} */
|
|
17
17
|
export const baseConfig = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
ignores: [
|
|
32
|
-
'dist/**',
|
|
33
|
-
'build/**',
|
|
34
|
-
'out/**',
|
|
35
|
-
'coverage/**',
|
|
36
|
-
'node_modules/**',
|
|
37
|
-
'eslint.config.js',
|
|
38
|
-
'eslint.config.mjs',
|
|
39
|
-
'eslint.config.cjs',
|
|
40
|
-
'*.config.js',
|
|
41
|
-
'*.config.mjs',
|
|
42
|
-
'*.config.cjs',
|
|
43
|
-
],
|
|
18
|
+
name: '@jabworks/eslint-config-base',
|
|
19
|
+
plugins: {
|
|
20
|
+
unicorn,
|
|
21
|
+
'simple-import-sort': simpleImportSort,
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
...bestPractice,
|
|
25
|
+
...es6,
|
|
26
|
+
...importConfig,
|
|
27
|
+
...possibleErrors,
|
|
28
|
+
...stylistic,
|
|
29
|
+
...variables,
|
|
30
|
+
},
|
|
44
31
|
};
|
|
45
32
|
|
|
46
33
|
/** @type {import('eslint').Linter.Config[]} */
|
|
47
34
|
const configs = [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
35
|
+
eslintjs.configs.recommended,
|
|
36
|
+
eslintConfigPrettier,
|
|
37
|
+
...tseslint.configs.recommended,
|
|
38
|
+
importPlugin.flatConfigs.recommended,
|
|
39
|
+
...comments,
|
|
40
|
+
stylisticPlugin.configs.customize({
|
|
41
|
+
semi: true,
|
|
42
|
+
arrowParens: 'as-needed',
|
|
43
|
+
}),
|
|
44
|
+
baseConfig,
|
|
45
|
+
{
|
|
46
|
+
ignores: [
|
|
47
|
+
'dist/**',
|
|
48
|
+
'build/**',
|
|
49
|
+
'out/**',
|
|
50
|
+
'coverage/**',
|
|
51
|
+
'node_modules/**',
|
|
52
|
+
'eslint.config.js',
|
|
53
|
+
'eslint.config.mjs',
|
|
54
|
+
'eslint.config.cjs',
|
|
55
|
+
'*.config.js',
|
|
56
|
+
'*.config.mjs',
|
|
57
|
+
'*.config.cjs',
|
|
58
|
+
],
|
|
59
|
+
},
|
|
58
60
|
];
|
|
59
61
|
|
|
60
62
|
export default configs;
|
package/src/configs/next.js
CHANGED
|
@@ -12,75 +12,77 @@ import tseslintConfigs, { tseslintConfig } from './typescript.js';
|
|
|
12
12
|
|
|
13
13
|
/** @type {import('eslint').Linter.Config[]} */
|
|
14
14
|
const configs = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
15
|
+
...baseConfig,
|
|
16
|
+
js.configs.recommended,
|
|
17
|
+
eslintConfigPrettier,
|
|
18
|
+
importPlugin.flatConfigs.recommended,
|
|
19
|
+
pluginReact.configs.flat.recommended,
|
|
20
|
+
pluginReact.configs.flat['jsx-runtime'],
|
|
21
|
+
...tseslintConfigs,
|
|
22
|
+
{
|
|
23
|
+
name: '@jabworks/eslint-config-nextjs',
|
|
24
|
+
plugins: {
|
|
25
|
+
'@next/next': pluginNext,
|
|
26
|
+
'react-hooks': pluginReactHooks,
|
|
27
|
+
},
|
|
28
|
+
languageOptions: {
|
|
29
|
+
...pluginReact.configs.flat.recommended?.languageOptions,
|
|
30
|
+
globals: {
|
|
31
|
+
...globals.serviceworker,
|
|
32
|
+
...globals.browser,
|
|
33
|
+
},
|
|
34
|
+
parserOptions: {
|
|
35
|
+
projectService: true,
|
|
36
|
+
tsconfigRootDir: import.meta.dirname,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
settings: {
|
|
40
|
+
'import/resolver': { node: {} },
|
|
41
|
+
react: { version: 'detect' },
|
|
42
|
+
},
|
|
43
|
+
linterOptions: {
|
|
44
|
+
reportUnusedDisableDirectives: true,
|
|
45
|
+
},
|
|
46
|
+
rules: {
|
|
47
|
+
...pluginReactHooks.configs['recommended-latest'].rules,
|
|
48
|
+
...reactRules,
|
|
49
|
+
...pluginNext.configs.recommended.rules,
|
|
50
|
+
...pluginNext.configs['core-web-vitals'].rules,
|
|
51
|
+
...tseslintConfig.rules,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
files: [
|
|
56
|
+
'*.config.ts',
|
|
57
|
+
'**/*.d.ts',
|
|
58
|
+
'**/*.stories.ts',
|
|
59
|
+
'**/*.stories.tsx',
|
|
60
|
+
'app/**/*error.tsx',
|
|
61
|
+
'app/**/layout.tsx',
|
|
62
|
+
'app/**/not-found.tsx',
|
|
63
|
+
'app/**/opengraph-image.tsx',
|
|
64
|
+
'app/**/page.tsx',
|
|
65
|
+
'app/apple-icon.tsx',
|
|
66
|
+
'app/robots.ts',
|
|
67
|
+
'app/sitemap.ts',
|
|
68
|
+
'next.config.mjs',
|
|
69
|
+
'src/app/**/*error.tsx',
|
|
70
|
+
'src/app/**/layout.tsx',
|
|
71
|
+
'src/app/**/not-found.tsx',
|
|
72
|
+
'src/app/**/opengraph-image.tsx',
|
|
73
|
+
'src/app/**/page.tsx',
|
|
74
|
+
'src/app/apple-icon.tsx',
|
|
75
|
+
'src/app/robots.ts',
|
|
76
|
+
'src/app/sitemap.ts',
|
|
77
|
+
],
|
|
78
|
+
rules: {
|
|
79
|
+
'import/no-default-export': 'off',
|
|
80
|
+
'import/prefer-default-export': ['error', { target: 'any' }],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
ignores: ['.next/**'],
|
|
85
|
+
},
|
|
84
86
|
];
|
|
85
87
|
|
|
86
88
|
export default configs;
|
package/src/index.js
CHANGED
|
@@ -10,16 +10,16 @@ const { name, version } = pkg;
|
|
|
10
10
|
|
|
11
11
|
/** @type {import('eslint').ESLint.Plugin} */
|
|
12
12
|
export const plugin = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
meta: {
|
|
14
|
+
name,
|
|
15
|
+
version,
|
|
16
|
+
},
|
|
17
|
+
configs: {
|
|
18
|
+
base,
|
|
19
|
+
comments,
|
|
20
|
+
next,
|
|
21
|
+
react,
|
|
22
|
+
typescript,
|
|
23
|
+
vitest,
|
|
24
|
+
},
|
|
25
25
|
};
|