eslint-config-dolmios 2.0.3 → 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 CHANGED
@@ -17,14 +17,38 @@ This ESLint configuration is designed for use with ESLint v9, which uses a flat
17
17
 
18
18
 
19
19
  ```js
20
- import dolmiosConfig from "eslint-config-dolmios";
20
+ import dolmios from "eslint-config-dolmios";
21
21
 
22
22
  export default [
23
- ...dolmiosConfig,
23
+ ...dolmios,
24
24
  // Add any project-specific overrides here
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
@@ -24,19 +24,21 @@ export default [
24
24
  '**/public/**',
25
25
  '**/storybook-static/**',
26
26
  '**/test/**',
27
- '**/tests/**'
27
+ '**/tests/**',
28
+ '**/eslint.config.js',
29
+ '**/eslint.config.mjs',
30
+ '**/eslint.config.cjs',
31
+ '**/next.config.js'
28
32
  ],
29
33
  },
30
34
  {
31
- files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
35
+ files: ['**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs', '**/*.ts', '**/*.tsx'],
32
36
  languageOptions: {
33
37
  parser: tsParser,
34
38
  parserOptions: {
35
39
  ecmaVersion: 'latest',
36
40
  sourceType: 'module',
37
41
  ecmaFeatures: { jsx: true },
38
- project: './tsconfig.json',
39
- tsconfigRootDir: '.',
40
42
  },
41
43
  globals: {
42
44
  ...globals.browser,
@@ -61,4 +63,15 @@ export default [
61
63
  },
62
64
  rules: customRules,
63
65
  },
66
+ {
67
+ files: ['**/*.ts', '**/*.tsx'],
68
+ languageOptions: {
69
+ parserOptions: {
70
+ project: './tsconfig.json',
71
+ tsconfigRootDir: '.',
72
+ },
73
+ },
74
+ rules: {
75
+ },
76
+ },
64
77
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-dolmios",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "A simple ESLint config with Prettier and a couple TSConfig setups",
5
5
  "author": "Jackson Dolman <mail@dolmios.com>",
6
6
  "bugs": {
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', ignoreRestSiblings: true, argsIgnorePattern: '^_' },
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', { grouping: true, allowCall: false }],
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': [