@tata-v/eslint-config-nextjs 1.0.6 → 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.
Files changed (3) hide show
  1. package/README.md +33 -0
  2. package/index.js +119 -105
  3. package/package.json +12 -6
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ `eslint-config-next` is included by `@tata-v/eslint-config-nextjs` and does not need to be installed separately.
2
+
3
+ ### Install
4
+
5
+ ```bash
6
+ pnpm add -D @tata-v/eslint-config-nextjs@latest
7
+ ```
8
+
9
+ ### eslint.config.mjs
10
+
11
+ ```mjs
12
+ import { defineConfig, globalIgnores } from 'eslint/config';
13
+ import tataNextConfig from '@tata-v/eslint-config-nextjs';
14
+
15
+ export default defineConfig([
16
+ ...tataNextConfig(),
17
+
18
+ globalIgnores([
19
+ '.next/**',
20
+ 'out/**',
21
+ 'build/**',
22
+ 'next-env.d.ts',
23
+ ]),
24
+
25
+ // Project-specific overrides (optional)
26
+ {
27
+ rules: {
28
+ '@next/next/no-img-element': 'off',
29
+ '@typescript-eslint/no-explicit-any': 'off',
30
+ },
31
+ },
32
+ ]);
33
+ ```
package/index.js CHANGED
@@ -1,106 +1,120 @@
1
- module.exports = {
2
- env: { browser: true, es2020: true, node: true },
3
- extends: [
4
- 'airbnb',
5
- 'airbnb-typescript',
6
- 'eslint:recommended',
7
- 'plugin:import/errors',
8
- 'plugin:import/warnings'
9
- ],
10
- plugins: ['@typescript-eslint/eslint-plugin'],
11
- rules: {
12
- 'no-var': 'warn',
13
- 'eqeqeq': 'warn',
14
- 'react/prop-types': 0,
15
- 'no-extra-semi': 'error',
16
- 'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
17
- 'import/prefer-default-export': 'off',
18
- 'react-hooks/exhaustive-deps': 'off',
19
- 'react/jsx-pascal-case': 'warn',
20
- 'react/jsx-key': 'warn',
21
- 'no-debugger': 'off',
22
- 'react/function-component-definition': [2, { namedComponents: ['arrow-function', 'function-declaration'] }],
23
- 'react/react-in-jsx-scope': 0,
24
- 'react/prefer-stateless-function': 0,
25
- 'react/jsx-one-expression-per-line': 0,
26
- 'no-nested-ternary': 0,
27
- 'import/no-unresolved': 'off',
28
- 'react/jsx-props-no-spreading': 'off',
29
- 'linebreak-style': 0,
30
- 'import/extensions': 'off',
31
- 'no-use-before-define': 0,
32
- 'import/no-extraneous-dependencies': 0,
33
- 'no-shadow': 0,
34
- 'jsx-a11y/no-noninteractive-element-interactions': 0,
35
- 'quotes': ['error', 'single'],
36
- 'indent': ['error', 2, { SwitchCase: 1 }],
37
- 'arrow-parens': ['error', 'always'],
38
- 'no-console': 'warn',
39
- 'react/button-has-type': 'off',
40
- 'no-alert': 'off',
41
- 'max-len': 'off',
42
- 'jsx-a11y/click-events-have-key-events': 'off',
43
- 'jsx-a11y/no-static-element-interactions': 'off',
44
- '@typescript-eslint/no-unused-vars': 'off',
45
- 'react/destructuring-assignment': 'off',
46
- 'react/no-array-index-key': 'off',
47
- 'no-param-reassign': 'off',
48
- 'no-undef': 'off',
49
- '@typescript-eslint/no-explicit-any': 'off',
50
- 'object-curly-newline': 'off',
51
- 'semi': ['error', 'always'],
52
- 'react/jsx-no-useless-fragment': 'off',
53
- 'react/no-unused-prop-types': 'warn',
54
- 'jsx-a11y/control-has-associated-label': 'off',
55
- 'react/require-default-props': 'off',
56
- 'consistent-return': 'off',
57
- '@typescript-eslint/no-var-requires': 'off',
58
- 'import/order': 'off',
59
- 'no-tabs': 'off',
60
- 'camelcase': 'off',
61
- 'dot-notation': 'off',
62
- 'no-redeclare:': 'off',
63
- 'prefer-destructuring': 'off',
64
- 'no-unsafe-optional-chaining': 'off',
65
- 'jsx-a11y/label-has-associated-control': 'off',
66
- 'import/no-absolute-path': 'error',
67
- 'func-names': 'off',
68
- 'react/no-unknown-property': 'off',
69
- 'no-multi-assign': 'off',
70
- '@typescript-eslint/no-use-before-define': 'off',
71
- 'no-plusplus': 'off',
72
- 'no-return-assign': 'off',
73
- 'react-hooks/rules-of-hooks': 'off',
74
- 'no-restricted-imports': [
75
- 'error',
76
- {
77
- 'patterns': ['@/*']
78
- }
79
- ],
80
- '@typescript-eslint/comma-dangle': 'off',
81
- '@typescript-eslint/comma-spacing': 'off',
82
- '@typescript-eslint/func-call-spacing': 'off',
83
- '@typescript-eslint/indent': 'off',
84
- '@typescript-eslint/keyword-spacing': 'off',
85
- '@typescript-eslint/lines-between-class-members': 'off',
86
- '@typescript-eslint/no-extra-semi': 'off',
87
- '@typescript-eslint/space-before-blocks': 'off',
88
- '@typescript-eslint/no-throw-literal': 'off',
89
- '@typescript-eslint/quotes': 'off',
90
- '@typescript-eslint/semi': 'off',
91
- '@typescript-eslint/space-before-function-paren': 'off',
92
- '@typescript-eslint/space-infix-ops': 'off',
93
- '@typescript-eslint/object-curly-spacing': 'off',
94
- '@typescript-eslint/brace-style': 'off',
95
- 'comma-spacing': ['error', { 'before': false, 'after': true }],
96
- // 'space-infix-ops': ['error', { 'int32Hint': false }],
97
- },
98
- settings: {
99
- 'import/resolver': {
100
- 'node': {
101
- 'paths': ['src'],
102
- 'extensions': ['.js', '.jsx', '.ts', '.tsx']
103
- }
104
- }
105
- }
1
+ import nextVitals from 'eslint-config-next/core-web-vitals';
2
+ import nextTs from 'eslint-config-next/typescript';
3
+ import stylistic from '@stylistic/eslint-plugin';
4
+
5
+ export default function tataNextConfig(options = {}) {
6
+ const {
7
+ files = ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
8
+ } = options;
9
+
10
+ return [
11
+ ...nextVitals,
12
+ ...nextTs,
13
+
14
+ {
15
+ files,
16
+ plugins: {
17
+ '@stylistic': stylistic,
18
+ },
19
+
20
+ rules: {
21
+ // Stylistic
22
+ '@stylistic/indent': ['error', 2, { SwitchCase: 1, ignoredNodes: ['TSTypeAliasDeclaration *', 'TSUnionType', 'TSIntersectionType'] }],
23
+
24
+ // ESLint core
25
+ eqeqeq: 'warn',
26
+ 'no-var': 'warn',
27
+ 'no-extra-semi': 'error',
28
+ 'no-debugger': 'off',
29
+ 'no-nested-ternary': 'off',
30
+ 'no-alert': 'off',
31
+ 'max-len': 'off',
32
+ 'no-use-before-define': 'off',
33
+ 'no-shadow': 'off',
34
+ 'no-param-reassign': 'off',
35
+ 'no-undef': 'off',
36
+ 'object-curly-newline': 'off',
37
+ 'consistent-return': 'off',
38
+ 'no-tabs': 'off',
39
+ camelcase: 'off',
40
+ 'dot-notation': 'off',
41
+ 'no-redeclare': 'off',
42
+ 'prefer-destructuring': 'off',
43
+ 'no-unsafe-optional-chaining': 'off',
44
+ 'func-names': 'off',
45
+ 'no-multi-assign': 'off',
46
+ 'no-plusplus': 'off',
47
+ 'no-return-assign': 'off',
48
+
49
+ // formatting
50
+ quotes: ['error', 'single'],
51
+ 'arrow-parens': ['error', 'always'],
52
+ semi: ['error', 'always'],
53
+ 'comma-spacing': ['error', { before: false, after: true }],
54
+
55
+ // React
56
+ 'react/prop-types': 'off',
57
+ 'react/jsx-filename-extension': [
58
+ 'error',
59
+ { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
60
+ ],
61
+ 'react/jsx-pascal-case': 'warn',
62
+ 'react/jsx-key': 'warn',
63
+ 'react/function-component-definition': [
64
+ 'error',
65
+ {
66
+ namedComponents: [
67
+ 'arrow-function',
68
+ 'function-declaration',
69
+ ],
70
+ },
71
+ ],
72
+ 'react/react-in-jsx-scope': 'off',
73
+ 'react/prefer-stateless-function': 'off',
74
+ 'react/jsx-one-expression-per-line': 'off',
75
+ 'react/jsx-props-no-spreading': 'off',
76
+ 'react/button-has-type': 'off',
77
+ 'react/destructuring-assignment': 'off',
78
+ 'react/no-array-index-key': 'off',
79
+ 'react/jsx-no-useless-fragment': 'off',
80
+ 'react/no-unused-prop-types': 'warn',
81
+ 'react/require-default-props': 'off',
82
+ 'react/no-unknown-property': 'off',
83
+
84
+ // Hooks
85
+ 'react-hooks/exhaustive-deps': 'off',
86
+ 'react-hooks/rules-of-hooks': 'off',
87
+
88
+ // Import
89
+ 'import/prefer-default-export': 'off',
90
+ 'import/no-unresolved': 'off',
91
+ 'import/extensions': 'off',
92
+ 'import/no-extraneous-dependencies': 'off',
93
+ 'import/order': 'off',
94
+ 'import/no-absolute-path': 'error',
95
+
96
+ // A11y
97
+ 'jsx-a11y/no-noninteractive-element-interactions': 'off',
98
+ 'jsx-a11y/click-events-have-key-events': 'off',
99
+ 'jsx-a11y/no-static-element-interactions': 'off',
100
+ 'jsx-a11y/control-has-associated-label': 'off',
101
+ 'jsx-a11y/label-has-associated-control': 'off',
102
+
103
+ // TypeScript
104
+ '@typescript-eslint/no-unused-vars': 'off',
105
+ '@typescript-eslint/no-explicit-any': 'off',
106
+ '@typescript-eslint/no-var-requires': 'off',
107
+ '@typescript-eslint/no-use-before-define': 'off',
108
+ },
109
+
110
+ settings: {
111
+ 'import/resolver': {
112
+ node: {
113
+ paths: ['src'],
114
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
115
+ },
116
+ },
117
+ },
118
+ },
119
+ ];
106
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tata-v/eslint-config-nextjs",
3
- "version": "1.0.6",
3
+ "version": "2.0.5",
4
4
  "main": "index.js",
5
5
  "keywords": [],
6
6
  "author": {
@@ -12,11 +12,17 @@
12
12
  "access": "public",
13
13
  "registry": "https://registry.npmjs.org/"
14
14
  },
15
+ "peerDependencies": {
16
+ "eslint": "^9.7.0",
17
+ "next": ">=15.0.0",
18
+ "typescript": ">=5.0.0"
19
+ },
15
20
  "dependencies": {
16
- "@typescript-eslint/eslint-plugin": "^8.14.0",
17
- "eslint-config-airbnb": "^18.2.1",
18
- "eslint-config-airbnb-typescript": "^18.0.0",
19
- "eslint-plugin-import": "^2.31.0",
20
- "eslint-plugin-jsx-a11y": "^6.10.2"
21
+ "@stylistic/eslint-plugin": "^5.0.0",
22
+ "eslint-config-next": "^16.0.0"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/TATA-V/tata-eslint-config"
21
27
  }
22
28
  }