@innovixx/eslint-config 3.0.13 → 4.0.0-alpha.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.
@@ -1,17 +1,14 @@
1
1
  /** @type {import('eslint').Linter.Config} */
2
2
 
3
3
  const typeScriptSettings = {
4
- settings: {
5
- 'import/resolver': {
6
- node: {
7
- extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
8
- },
9
- typescript: {},
10
- },
11
- react: {
12
- version: 'detect',
13
- },
14
- },
4
+ settings: {
5
+ 'import/resolver': {
6
+ node: {
7
+ extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
8
+ },
9
+ typescript: {},
10
+ },
11
+ },
15
12
  };
16
13
 
17
14
  export default typeScriptSettings;
@@ -4,59 +4,59 @@
4
4
  * Merges obj2 into obj1
5
5
  */
6
6
  export function _deepMerge(obj1, obj2, doNotMergeInNulls = true) {
7
- const output = { ...obj1 };
7
+ const output = { ...obj1 };
8
8
 
9
- // eslint-disable-next-line no-restricted-syntax
10
- for (const key in obj2) {
11
- if (Object.prototype.hasOwnProperty.call(obj2, key)) {
12
- if (doNotMergeInNulls) {
13
- if (
14
- (obj2[key] === null || obj2[key] === undefined)
15
- && obj1[key] !== null
16
- && obj1[key] !== undefined
17
- ) {
18
- // eslint-disable-next-line no-continue
19
- continue;
20
- }
21
- }
9
+ // eslint-disable-next-line no-restricted-syntax
10
+ for (const key in obj2) {
11
+ if (Object.prototype.hasOwnProperty.call(obj2, key)) {
12
+ if (doNotMergeInNulls) {
13
+ if (
14
+ (obj2[key] === null || obj2[key] === undefined)
15
+ && obj1[key] !== null
16
+ && obj1[key] !== undefined
17
+ ) {
18
+ // eslint-disable-next-line no-continue
19
+ continue;
20
+ }
21
+ }
22
22
 
23
- // Check if both are arrays
24
- if (Array.isArray(obj1[key]) && Array.isArray(obj2[key])) {
25
- // Merge each element in the arrays
23
+ // Check if both are arrays
24
+ if (Array.isArray(obj1[key]) && Array.isArray(obj2[key])) {
25
+ // Merge each element in the arrays
26
26
 
27
- // We need the Array.from, map rather than a normal map because this handles holes in arrays properly. A simple .map would skip holes.
28
- output[key] = Array.from(obj2[key], (item, index) => {
29
- if (doNotMergeInNulls) {
30
- if (
31
- (item === undefined || item === null)
32
- && obj1[key][index] !== null
33
- && obj1[key][index] !== undefined
34
- ) {
35
- return obj1[key][index];
36
- }
37
- }
27
+ // We need the Array.from, map rather than a normal map because this handles holes in arrays properly. A simple .map would skip holes.
28
+ output[key] = Array.from(obj2[key], (item, index) => {
29
+ if (doNotMergeInNulls) {
30
+ if (
31
+ (item === undefined || item === null)
32
+ && obj1[key][index] !== null
33
+ && obj1[key][index] !== undefined
34
+ ) {
35
+ return obj1[key][index];
36
+ }
37
+ }
38
38
 
39
- if (typeof item === 'object' && !Array.isArray(item) && obj1[key][index]) {
40
- // Deep merge for objects in arrays
41
- // eslint-disable-next-line no-use-before-define
42
- return deepMerge(obj1[key][index], item, doNotMergeInNulls);
43
- }
44
- return item;
45
- });
46
- } else if (typeof obj2[key] === 'object' && !Array.isArray(obj2[key]) && obj1[key]) {
47
- // Existing behavior for objects
48
- // eslint-disable-next-line no-use-before-define
49
- output[key] = deepMerge(obj1[key], obj2[key], doNotMergeInNulls);
50
- } else {
51
- // Direct assignment for values
52
- output[key] = obj2[key];
53
- }
54
- }
55
- }
39
+ if (typeof item === 'object' && !Array.isArray(item) && obj1[key][index]) {
40
+ // Deep merge for objects in arrays
41
+ // eslint-disable-next-line no-use-before-define
42
+ return deepMerge(obj1[key][index], item, doNotMergeInNulls);
43
+ }
44
+ return item;
45
+ });
46
+ } else if (typeof obj2[key] === 'object' && !Array.isArray(obj2[key]) && obj1[key]) {
47
+ // Existing behavior for objects
48
+ // eslint-disable-next-line no-use-before-define
49
+ output[key] = deepMerge(obj1[key], obj2[key], doNotMergeInNulls);
50
+ } else {
51
+ // Direct assignment for values
52
+ output[key] = obj2[key];
53
+ }
54
+ }
55
+ }
56
56
 
57
- return output;
57
+ return output;
58
58
  }
59
59
 
60
60
  export function deepMerge(...objs) {
61
- return objs.reduce((acc, obj) => _deepMerge(acc, obj), {});
61
+ return objs.reduce((acc, obj) => _deepMerge(acc, obj), {});
62
62
  }
package/config/index.mjs CHANGED
@@ -6,137 +6,137 @@ import jestExtends from './configs/jest/index.mjs';
6
6
  import { deepMerge } from './deepMerge.mjs';
7
7
 
8
8
  const baseRules = {
9
- 'class-methods-use-this': 'off',
10
- curly: ['warn', 'all'],
11
- 'arrow-body-style': ['error', 'as-needed', {
12
- requireReturnForObjectLiteral: false,
13
- }],
14
- 'no-restricted-exports': ['warn', { restrictDefaultExports: { direct: true } }],
15
- 'no-console': 'warn',
16
- 'no-sparse-arrays': 'off',
17
- 'no-underscore-dangle': 'off',
18
- 'no-use-before-define': 'off',
19
- 'object-shorthand': 'warn',
20
- 'no-useless-escape': 'warn',
9
+ 'class-methods-use-this': 'off',
10
+ curly: ['warn', 'all'],
11
+ 'arrow-body-style': ['error', 'as-needed', {
12
+ requireReturnForObjectLiteral: false,
13
+ }],
14
+ 'no-restricted-exports': ['warn', { restrictDefaultExports: { direct: true } }],
15
+ 'no-console': 'warn',
16
+ 'no-sparse-arrays': 'off',
17
+ 'no-underscore-dangle': 'off',
18
+ 'no-use-before-define': 'off',
19
+ 'object-shorthand': 'warn',
20
+ 'no-useless-escape': 'warn',
21
21
  };
22
22
 
23
23
  const reactA11yRules = {
24
- 'jsx-a11y/anchor-is-valid': 'warn',
25
- 'jsx-a11y/control-has-associated-label': 'warn',
26
- 'jsx-a11y/no-static-element-interactions': 'warn',
27
- 'jsx-a11y/label-has-associated-control': 'warn',
24
+ 'jsx-a11y/anchor-is-valid': 'warn',
25
+ 'jsx-a11y/control-has-associated-label': 'warn',
26
+ 'jsx-a11y/no-static-element-interactions': 'warn',
27
+ 'jsx-a11y/label-has-associated-control': 'warn',
28
28
  };
29
29
 
30
30
  const typeScriptRules = {
31
- '@typescript-eslint/no-use-before-define': 'off',
31
+ '@typescript-eslint/no-use-before-define': 'off',
32
32
 
33
- // Type-aware any rules:
34
- '@typescript-eslint/no-unsafe-assignment': 'off',
35
- '@typescript-eslint/no-unsafe-member-access': 'off',
36
- '@typescript-eslint/no-unsafe-call': 'off',
37
- '@typescript-eslint/no-unsafe-argument': 'off',
38
- '@typescript-eslint/no-unsafe-return': 'off',
39
- '@typescript-eslint/unbound-method': 'warn',
40
- '@typescript-eslint/consistent-type-imports': 'warn',
41
- '@typescript-eslint/no-explicit-any': 'warn',
42
- // Type-aware any rules end
33
+ // Type-aware any rules:
34
+ '@typescript-eslint/no-unsafe-assignment': 'off',
35
+ '@typescript-eslint/no-unsafe-member-access': 'off',
36
+ '@typescript-eslint/no-unsafe-call': 'off',
37
+ '@typescript-eslint/no-unsafe-argument': 'off',
38
+ '@typescript-eslint/no-unsafe-return': 'off',
39
+ '@typescript-eslint/unbound-method': 'warn',
40
+ '@typescript-eslint/consistent-type-imports': 'warn',
41
+ '@typescript-eslint/no-explicit-any': 'warn',
42
+ // Type-aware any rules end
43
43
 
44
- // ts-expect preferred over ts-ignore. It will error if the expected error is no longer present.
45
- '@typescript-eslint/ban-ts-comment': 'warn', // Recommended over deprecated @typescript-eslint/prefer-ts-expect-error: https://github.com/typescript-eslint/typescript-eslint/issues/8333. Set to warn to ease migration.
46
- // By default, it errors for unused variables. This is annoying, warnings are enough.
47
- '@typescript-eslint/no-unused-vars': [
48
- 'warn',
49
- {
50
- vars: 'all',
51
- args: 'after-used',
52
- ignoreRestSiblings: false,
53
- argsIgnorePattern: '^_',
54
- varsIgnorePattern: '^_',
55
- destructuredArrayIgnorePattern: '^_',
56
- caughtErrorsIgnorePattern: '^(_|ignore)',
57
- },
58
- ],
59
- '@typescript-eslint/no-base-to-string': 'warn',
60
- '@typescript-eslint/restrict-template-expressions': 'warn',
61
- '@typescript-eslint/no-redundant-type-constituents': 'warn',
62
- '@typescript-eslint/no-unnecessary-type-constraint': 'warn',
63
- '@typescript-eslint/no-misused-promises': [
64
- 'error',
65
- {
66
- // See https://github.com/typescript-eslint/typescript-eslint/issues/4619 and https://github.com/typescript-eslint/typescript-eslint/pull/4623
67
- // Don't want something like <button onClick={someAsyncFunction}> to error
68
- checksVoidReturn: {
69
- attributes: false,
70
- arguments: false,
71
- },
72
- },
73
- ],
74
- '@typescript-eslint/no-empty-object-type': 'warn',
44
+ // ts-expect preferred over ts-ignore. It will error if the expected error is no longer present.
45
+ '@typescript-eslint/ban-ts-comment': 'warn', // Recommended over deprecated @typescript-eslint/prefer-ts-expect-error: https://github.com/typescript-eslint/typescript-eslint/issues/8333. Set to warn to ease migration.
46
+ // By default, it errors for unused variables. This is annoying, warnings are enough.
47
+ '@typescript-eslint/no-unused-vars': [
48
+ 'warn',
49
+ {
50
+ vars: 'all',
51
+ args: 'after-used',
52
+ ignoreRestSiblings: false,
53
+ argsIgnorePattern: '^_',
54
+ varsIgnorePattern: '^_',
55
+ destructuredArrayIgnorePattern: '^_',
56
+ caughtErrorsIgnorePattern: '^(_|ignore)',
57
+ },
58
+ ],
59
+ '@typescript-eslint/no-base-to-string': 'warn',
60
+ '@typescript-eslint/restrict-template-expressions': 'warn',
61
+ '@typescript-eslint/no-redundant-type-constituents': 'warn',
62
+ '@typescript-eslint/no-unnecessary-type-constraint': 'warn',
63
+ '@typescript-eslint/no-misused-promises': [
64
+ 'error',
65
+ {
66
+ // See https://github.com/typescript-eslint/typescript-eslint/issues/4619 and https://github.com/typescript-eslint/typescript-eslint/pull/4623
67
+ // Don't want something like <button onClick={someAsyncFunction}> to error
68
+ checksVoidReturn: {
69
+ attributes: false,
70
+ arguments: false,
71
+ },
72
+ },
73
+ ],
74
+ '@typescript-eslint/no-empty-object-type': 'warn',
75
75
  };
76
76
 
77
77
  /** @typedef {import('eslint').Linter.Config} Config */
78
78
 
79
79
  /** @type {Config[]} */
80
80
  export const rootEslintConfig = [
81
- {
82
- name: 'Settings',
83
- languageOptions: {
84
- parserOptions: {
85
- ecmaFeatures: {
86
- jsx: true,
87
- },
88
- },
89
- ecmaVersion: 'latest',
90
- sourceType: 'module',
91
- globals: {
92
- ...globals.node,
93
- },
94
- parser: typescriptParser,
95
- },
96
- },
97
- {
98
- name: 'TypeScript',
99
- // has 3 entries: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/src/configs/recommended-type-checked.ts
100
- ...deepMerge(
101
- tseslint.configs.recommendedTypeCheckedOnly[0],
102
- tseslint.configs.recommendedTypeCheckedOnly[1],
103
- tseslint.configs.recommendedTypeCheckedOnly[2],
104
- {
105
- rules: {
106
- ...baseRules,
107
- ...typeScriptRules,
108
- },
109
- },
110
- ),
111
- files: ['**/*.ts'],
112
- },
113
- {
114
- name: 'TypeScript-React',
115
- ...deepMerge(
116
- tseslint.configs.recommendedTypeCheckedOnly[0],
117
- tseslint.configs.recommendedTypeCheckedOnly[1],
118
- tseslint.configs.recommendedTypeCheckedOnly[2],
119
- reactExtends,
120
- {
121
- rules: {
122
- ...baseRules,
123
- ...typeScriptRules,
124
- ...reactA11yRules,
125
- },
126
- },
127
- ),
128
- files: ['**/*.tsx'],
129
- },
130
- {
131
- name: 'Unit Tests',
132
- ...deepMerge(jestExtends, {
133
- rules: {
134
- ...baseRules,
135
- ...typeScriptRules,
136
- },
137
- }),
138
- files: ['**/*.test.ts', '**/*.test.tsx'],
139
- },
81
+ {
82
+ name: 'Settings',
83
+ languageOptions: {
84
+ parserOptions: {
85
+ ecmaFeatures: {
86
+ jsx: true,
87
+ },
88
+ },
89
+ ecmaVersion: 'latest',
90
+ sourceType: 'module',
91
+ globals: {
92
+ ...globals.node,
93
+ },
94
+ parser: typescriptParser,
95
+ },
96
+ },
97
+ {
98
+ name: 'TypeScript',
99
+ // has 3 entries: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/src/configs/recommended-type-checked.ts
100
+ ...deepMerge(
101
+ tseslint.configs.recommendedTypeCheckedOnly[0],
102
+ tseslint.configs.recommendedTypeCheckedOnly[1],
103
+ tseslint.configs.recommendedTypeCheckedOnly[2],
104
+ {
105
+ rules: {
106
+ ...baseRules,
107
+ ...typeScriptRules,
108
+ },
109
+ },
110
+ ),
111
+ files: ['**/*.ts'],
112
+ },
113
+ {
114
+ name: 'TypeScript-React',
115
+ ...deepMerge(
116
+ tseslint.configs.recommendedTypeCheckedOnly[0],
117
+ tseslint.configs.recommendedTypeCheckedOnly[1],
118
+ tseslint.configs.recommendedTypeCheckedOnly[2],
119
+ reactExtends,
120
+ {
121
+ rules: {
122
+ ...baseRules,
123
+ ...typeScriptRules,
124
+ ...reactA11yRules,
125
+ },
126
+ },
127
+ ),
128
+ files: ['**/*.tsx'],
129
+ },
130
+ {
131
+ name: 'Unit Tests',
132
+ ...deepMerge(jestExtends, {
133
+ rules: {
134
+ ...baseRules,
135
+ ...typeScriptRules,
136
+ },
137
+ }),
138
+ files: ['**/*.test.ts', '**/*.test.tsx'],
139
+ },
140
140
  ];
141
141
 
142
142
  export default rootEslintConfig;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
 
3
- export const ComponentTest: React.FC = () => <div>ComponentTest</div>;
3
+ export const ComponentTest: React.FC = () => <p>Component Test</p>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  interface Props {
4
- title: string;
4
+ title: string;
5
5
  }
6
6
 
7
- export const AnotherComponentTest: React.FC<Props> = ({ title }) => <div>{title}</div>;
7
+ export const AnotherComponentTest: React.FC<Props> = ({ title }) => <p style={{ textAlign: 'center' }}>{title}</p>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innovixx/eslint-config",
3
- "version": "3.0.13",
3
+ "version": "4.0.0-alpha.0",
4
4
  "main": "configs/index.mjs",
5
5
  "repository": "git@github.com:innovixx/eslint-config.git",
6
6
  "description": "Opinionated ESLint config for JavaScript developers",
@@ -17,31 +17,30 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@types/eslint": "9.6.1",
20
- "@types/node": "^26.1.1",
21
- "@types/react": "^19.2.17",
22
- "@types/react-dom": "^19.2.3",
23
- "globals": "17.7.0",
24
- "typescript": "6.0.3"
20
+ "@types/node": "^26.6.6",
21
+ "@types/react": "^19.3.0",
22
+ "@types/react-dom": "^19.3.0",
23
+ "globals": "17.14.0"
25
24
  },
26
25
  "peerDependencies": {
27
- "@eslint-react/eslint-plugin": "^5.17.3",
28
- "@eslint/js": "^10.0.1",
29
- "@typescript-eslint/eslint-plugin": "^8.64.0",
30
- "@typescript-eslint/parser": "^8.64.0",
31
- "eslint": "9.39.4",
26
+ "@eslint-react/eslint-plugin": "^5.28.8",
27
+ "@eslint-react/kit": "5.28.8",
28
+ "@stylistic/eslint-plugin": "^5.10.0",
29
+ "@typescript-eslint/eslint-plugin": "^8.72.1",
30
+ "@typescript-eslint/parser": "^8.72.1",
31
+ "eslint": "^10.14.0",
32
32
  "eslint-import-resolver-typescript": "^4.4.5",
33
33
  "eslint-plugin-import": "^2.32.0",
34
- "eslint-plugin-jest": "^29.15.4",
35
- "eslint-plugin-jest-dom": "^5.5.0",
34
+ "eslint-plugin-jest": "^29.17.0",
35
+ "eslint-plugin-jest-dom": "^5.10.1",
36
36
  "eslint-plugin-jsx-a11y": "^6.10.2",
37
- "eslint-plugin-n": "^18.2.2",
38
- "eslint-plugin-react": "^7.37.5",
37
+ "eslint-plugin-n": "^18.5.0",
39
38
  "eslint-plugin-react-hooks": "^7.1.1",
40
- "eslint-plugin-react-refresh": "^0.5.3",
39
+ "eslint-plugin-react-refresh": "^0.5.7",
41
40
  "eslint-plugin-sort-export-all": "^2.1.0",
42
- "eslint-plugin-sort-keys-fix": "^1.1.2",
43
- "react": "^19.2.7",
44
- "react-dom": "^19.2.7",
45
- "typescript-eslint": "^8.64.0"
41
+ "typescript-eslint": "^8.72.1"
42
+ },
43
+ "devDependencies": {
44
+ "typescript": "6.0.3"
46
45
  }
47
46
  }
package/tsconfig.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "sourceMap": true,
11
11
  "inlineSources": true,
12
12
  "sourceRoot": "/",
13
- "jsx": "react",
13
+ "jsx": "react-jsx",
14
14
  },
15
15
  "exclude": [
16
16
  "node_modules",