eslint-config-dolmios 2.0.4 → 2.0.5
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/README.md +25 -1
- package/eslint.config.js +1 -2
- package/package.json +1 -1
- package/rules.js +13 -13
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ This ESLint configuration is designed for use with ESLint v9, which uses a flat
|
|
|
13
13
|
### Setting Up ESLint
|
|
14
14
|
1. **Create an ESLint Configuration File**: In the root of your project, create a file named `eslint.config.js`.
|
|
15
15
|
|
|
16
|
-
2. **Import and Extend the Configuration**: Add the following content to `eslint.config.
|
|
16
|
+
2. **Import and Extend the Configuration**: Add the following content to `eslint.config.js` to use the `eslint-config-dolmios` configuration:
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
```js
|
|
@@ -25,6 +25,30 @@ export default [
|
|
|
25
25
|
];
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
- **TypeScript Support**: Comprehensive TypeScript linting with strict type checking
|
|
31
|
+
- **React Best Practices**: Rules for React and React Hooks
|
|
32
|
+
- **Accessibility**: A11y rules to ensure your app is accessible
|
|
33
|
+
- **Next.js Optimization**: Includes Next.js Core Web Vitals rules for performance optimization
|
|
34
|
+
- **Code Organization**: Perfectionist plugin for consistent code organization
|
|
35
|
+
- **Modern JavaScript**: Enforces modern JavaScript practices
|
|
36
|
+
|
|
37
|
+
### Next.js Compatibility
|
|
38
|
+
|
|
39
|
+
This configuration automatically detects your Next.js project structure and adjusts accordingly:
|
|
40
|
+
|
|
41
|
+
- **App Router Support**: Works with Next.js App Router projects
|
|
42
|
+
- **Pages Router Support**: Works with Next.js Pages Router projects
|
|
43
|
+
- **Non-Next.js Projects**: Works with regular React projects without Next.js
|
|
44
|
+
|
|
45
|
+
The configuration automatically detects:
|
|
46
|
+
- If you're using Next.js (by checking for `next.config.js`)
|
|
47
|
+
- If you're using App Router (by checking for an `app` directory)
|
|
48
|
+
- If you're using Pages Router (by checking for `pages` or `src/pages` directories)
|
|
49
|
+
|
|
50
|
+
Rules like `no-html-link-for-pages` are only enabled when a Pages Router is detected.
|
|
51
|
+
|
|
28
52
|
---
|
|
29
53
|
|
|
30
54
|
### Usage with Prettier
|
package/eslint.config.js
CHANGED
package/package.json
CHANGED
package/rules.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
// TypeScript specific rules
|
|
4
4
|
const typescriptRules = {
|
|
5
|
+
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': 'allow-with-description' }],
|
|
5
6
|
'@typescript-eslint/explicit-function-return-type': 'warn',
|
|
7
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
8
|
+
'@typescript-eslint/no-inferrable-types': 'warn',
|
|
6
9
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
7
10
|
'@typescript-eslint/no-unused-vars': [
|
|
8
11
|
'warn',
|
|
9
|
-
{ args: 'none',
|
|
12
|
+
{ args: 'none', argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
10
13
|
],
|
|
11
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
12
|
-
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': 'allow-with-description' }],
|
|
13
|
-
'@typescript-eslint/no-inferrable-types': 'warn',
|
|
14
14
|
'@typescript-eslint/prefer-as-const': 'warn',
|
|
15
15
|
'no-unused-vars': 'off',
|
|
16
16
|
};
|
|
@@ -39,6 +39,8 @@ const a11yRules = {
|
|
|
39
39
|
|
|
40
40
|
// React specific rules
|
|
41
41
|
const reactRules = {
|
|
42
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
43
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
42
44
|
'react/button-has-type': 'warn',
|
|
43
45
|
'react/destructuring-assignment': 'warn',
|
|
44
46
|
'react/display-name': 'off',
|
|
@@ -73,27 +75,25 @@ const reactRules = {
|
|
|
73
75
|
'react/sort-comp': 'warn',
|
|
74
76
|
'react/style-prop-object': 'warn',
|
|
75
77
|
'react/void-dom-elements-no-children': 'warn',
|
|
76
|
-
'react-hooks/exhaustive-deps': 'warn',
|
|
77
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
// Next.js rules
|
|
81
81
|
const nextRules = {
|
|
82
|
-
'@next/next/no-html-link-for-pages': 'warn',
|
|
83
|
-
'@next/next/no-img-element': 'warn',
|
|
84
|
-
'@next/next/no-unwanted-polyfillio': 'warn',
|
|
85
|
-
'@next/next/no-css-tags': 'warn',
|
|
86
|
-
'@next/next/no-sync-scripts': 'warn',
|
|
87
82
|
'@next/next/google-font-display': 'warn',
|
|
88
83
|
'@next/next/google-font-preconnect': 'warn',
|
|
89
84
|
'@next/next/next-script-for-ga': 'warn',
|
|
85
|
+
'@next/next/no-css-tags': 'warn',
|
|
86
|
+
'@next/next/no-html-link-for-pages': 'off',
|
|
87
|
+
'@next/next/no-img-element': 'warn',
|
|
90
88
|
'@next/next/no-page-custom-font': 'warn',
|
|
89
|
+
'@next/next/no-sync-scripts': 'warn',
|
|
90
|
+
'@next/next/no-unwanted-polyfillio': 'warn',
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
// Perfectionist rules
|
|
94
94
|
const perfectionistRules = {
|
|
95
|
-
'perfectionist/sort-objects': ['warn', { order: 'asc', type: 'natural' }],
|
|
96
95
|
'perfectionist/sort-imports': ['warn', { order: 'asc', type: 'natural' }],
|
|
96
|
+
'perfectionist/sort-objects': ['warn', { order: 'asc', type: 'natural' }],
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
// General JavaScript rules
|
|
@@ -113,7 +113,7 @@ const generalRules = {
|
|
|
113
113
|
'no-label-var': 'warn',
|
|
114
114
|
'no-labels': 'warn',
|
|
115
115
|
'no-lone-blocks': 'warn',
|
|
116
|
-
'no-mixed-requires': ['warn', {
|
|
116
|
+
'no-mixed-requires': ['warn', { allowCall: false, grouping: true }],
|
|
117
117
|
'no-multi-spaces': 'warn',
|
|
118
118
|
'no-multi-str': 'warn',
|
|
119
119
|
'no-multiple-empty-lines': [
|