@hayuno/eslint-config 1.0.12 → 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/index.mjs +15 -13
- package/package.json +6 -4
- package/rules/next.js +37 -2
package/index.mjs
CHANGED
|
@@ -10,7 +10,6 @@ import reactPlugin from 'eslint-plugin-react';
|
|
|
10
10
|
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
11
11
|
import testingLibraryPlugin from 'eslint-plugin-testing-library';
|
|
12
12
|
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
|
|
13
|
-
import nextPlugin from '@next/eslint-plugin-next';
|
|
14
13
|
import prettierConfig from 'eslint-config-prettier';
|
|
15
14
|
|
|
16
15
|
const require = createRequire(import.meta.url);
|
|
@@ -35,15 +34,6 @@ const compat = new FlatCompat({
|
|
|
35
34
|
allConfig: js.configs.all,
|
|
36
35
|
});
|
|
37
36
|
|
|
38
|
-
const legacyRuleConfigs = ['./rules/base'];
|
|
39
|
-
if (moduleExists('next')) legacyRuleConfigs.push('./rules/next');
|
|
40
|
-
if (moduleExists('react')) legacyRuleConfigs.push('./rules/react');
|
|
41
|
-
if (moduleExists('jest')) legacyRuleConfigs.push('./rules/jest');
|
|
42
|
-
if (moduleExists('typescript')) legacyRuleConfigs.push('./rules/typescript');
|
|
43
|
-
legacyRuleConfigs.push('./rules/prettier');
|
|
44
|
-
|
|
45
|
-
const baseConfigs = compat.extends(...legacyRuleConfigs.map(require.resolve));
|
|
46
|
-
|
|
47
37
|
const globalPlugins = [
|
|
48
38
|
{
|
|
49
39
|
plugins: {
|
|
@@ -53,14 +43,26 @@ const globalPlugins = [
|
|
|
53
43
|
react: reactPlugin,
|
|
54
44
|
'react-hooks': reactHooksPlugin,
|
|
55
45
|
'jsx-a11y': jsxA11yPlugin,
|
|
56
|
-
'@next/next': nextPlugin,
|
|
57
46
|
'testing-library': testingLibraryPlugin,
|
|
58
47
|
},
|
|
59
48
|
},
|
|
60
49
|
];
|
|
61
50
|
|
|
51
|
+
// Legacy Rules
|
|
52
|
+
const legacyRules = ['./rules/base'];
|
|
53
|
+
if (moduleExists('react')) legacyRules.push('./rules/react');
|
|
54
|
+
if (moduleExists('jest')) legacyRules.push('./rules/jest');
|
|
55
|
+
if (moduleExists('typescript')) legacyRules.push('./rules/typescript');
|
|
56
|
+
legacyRules.push('./rules/prettier');
|
|
57
|
+
|
|
58
|
+
const legacyRuleConfig = compat.extends(...legacyRules.map(require.resolve));
|
|
59
|
+
|
|
60
|
+
// Flat-config rules
|
|
61
|
+
const nextRuleConfig = moduleExists('next') ? [require('./rules/next.js')] : [];
|
|
62
|
+
|
|
63
|
+
// Custom Rules
|
|
62
64
|
const customPlugin = require('./rules/custom');
|
|
63
|
-
const
|
|
65
|
+
const customRuleConfig = {
|
|
64
66
|
plugins: {
|
|
65
67
|
'@hayuno': customPlugin,
|
|
66
68
|
},
|
|
@@ -69,4 +71,4 @@ const customRules = {
|
|
|
69
71
|
),
|
|
70
72
|
};
|
|
71
73
|
|
|
72
|
-
export default [...globalPlugins, ...
|
|
74
|
+
export default [...globalPlugins, ...legacyRuleConfig, ...nextRuleConfig, customRuleConfig, prettierConfig];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hayuno/eslint-config",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "ESLint configuration used for projects at Hayuno AG",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"prepare": "husky"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@next/eslint-plugin-next": ">=16.
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
37
|
+
"@next/eslint-plugin-next": ">=16.2.1",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^8.57.1",
|
|
39
39
|
"eslint-plugin-import": "^2.32.0",
|
|
40
40
|
"eslint-plugin-jest": "^29.15.0",
|
|
41
41
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"eslint-plugin-prettier": "^5.5.5",
|
|
44
44
|
"eslint-plugin-react": "^7.37.5",
|
|
45
45
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
46
|
-
"eslint-plugin-testing-library": "^7.16.
|
|
46
|
+
"eslint-plugin-testing-library": "^7.16.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"husky": "^9.1.7",
|
|
@@ -53,7 +53,9 @@
|
|
|
53
53
|
"@typescript-eslint/parser": "^8.37.0",
|
|
54
54
|
"eslint": ">=9.33.0",
|
|
55
55
|
"eslint-config-prettier": "^10.1.8",
|
|
56
|
+
"eslint-config-next": "^16.1.6",
|
|
56
57
|
"jest": "^30.2.0",
|
|
58
|
+
"next": "^16.1.6",
|
|
57
59
|
"prettier": "^3.6.2",
|
|
58
60
|
"typescript": ">=4.0.0"
|
|
59
61
|
},
|
package/rules/next.js
CHANGED
|
@@ -1,4 +1,39 @@
|
|
|
1
|
+
const nextPlugin = require('@next/eslint-plugin-next');
|
|
2
|
+
const coreWebVitalsConfig = require('eslint-config-next/core-web-vitals');
|
|
3
|
+
|
|
4
|
+
const { coreWebVitalRules } = coreWebVitalsConfig;
|
|
5
|
+
const recommendedRules = {
|
|
6
|
+
'@next/next/google-font-display': 'warn',
|
|
7
|
+
'@next/next/google-font-preconnect': 'warn',
|
|
8
|
+
'@next/next/next-script-for-ga': 'warn',
|
|
9
|
+
'@next/next/no-async-client-component': 'warn',
|
|
10
|
+
'@next/next/no-before-interactive-script-outside-document': 'warn',
|
|
11
|
+
'@next/next/no-css-tags': 'warn',
|
|
12
|
+
'@next/next/no-head-element': 'warn',
|
|
13
|
+
'@next/next/no-html-link-for-pages': 'warn',
|
|
14
|
+
'@next/next/no-img-element': 'warn',
|
|
15
|
+
'@next/next/no-page-custom-font': 'warn',
|
|
16
|
+
'@next/next/no-styled-jsx-in-document': 'warn',
|
|
17
|
+
'@next/next/no-sync-scripts': 'warn',
|
|
18
|
+
'@next/next/no-title-in-document-head': 'warn',
|
|
19
|
+
'@next/next/no-typos': 'warn',
|
|
20
|
+
'@next/next/no-unwanted-polyfillio': 'warn',
|
|
21
|
+
'@next/next/inline-script-id': 'error',
|
|
22
|
+
'@next/next/no-assign-module-variable': 'error',
|
|
23
|
+
'@next/next/no-document-import-in-page': 'error',
|
|
24
|
+
'@next/next/no-duplicate-head': 'error',
|
|
25
|
+
'@next/next/no-head-import-in-document': 'error',
|
|
26
|
+
'@next/next/no-script-component-in-head': 'error',
|
|
27
|
+
};
|
|
28
|
+
// Note: These recommended rules are a copy of the original set from the @next/next/recommended plugin
|
|
29
|
+
// which is currently not available in eslint-config-next
|
|
30
|
+
|
|
1
31
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
32
|
+
plugins: {
|
|
33
|
+
'@next/next': nextPlugin,
|
|
34
|
+
},
|
|
35
|
+
rules: {
|
|
36
|
+
...coreWebVitalRules,
|
|
37
|
+
...recommendedRules,
|
|
38
|
+
},
|
|
4
39
|
};
|