@frontify/eslint-config-react 0.17.6 → 1.0.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.
Files changed (3) hide show
  1. package/eslint.config.mjs +99 -0
  2. package/package.json +14 -12
  3. package/index.js +0 -34
@@ -0,0 +1,99 @@
1
+ // @ts-check
2
+
3
+ import eslintPluginReact from '@eslint-react/eslint-plugin';
4
+ import basicConfig from '@frontify/eslint-config-basic';
5
+ // @ts-expect-error No types available
6
+ import eslintPluginJsxA11yX from 'eslint-plugin-jsx-a11y-x';
7
+ import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
8
+ import tseslint from 'typescript-eslint';
9
+
10
+ export default tseslint.config(
11
+ basicConfig,
12
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument
13
+ eslintPluginJsxA11yX.flatConfigs.recommended,
14
+ eslintPluginReact.configs['recommended-type-checked'],
15
+ eslintPluginReactHooks.configs['recommended-latest'],
16
+ {
17
+ languageOptions: {
18
+ parserOptions: {
19
+ ecmaFeatures: {
20
+ jsx: true,
21
+ },
22
+ },
23
+ },
24
+ settings: {
25
+ react: {
26
+ version: 'detect',
27
+ },
28
+ },
29
+ },
30
+ {
31
+ linterOptions: {
32
+ reportUnusedDisableDirectives: true,
33
+ },
34
+ files: ['**/*.{js,jsx,ts,tsx}'],
35
+ rules: {
36
+ 'no-restricted-syntax': [
37
+ 'error',
38
+ {
39
+ selector:
40
+ "ImportDeclaration[source.value='react'] :matches(ImportDefaultSpecifier, ImportNamespaceSpecifier)",
41
+ message:
42
+ 'Default React import not allowed since we use the TypeScript jsx-transform. If you need a global type that collides with a React named export (such as `MouseEvent`), try using `globalThis.MouseHandler`.',
43
+ },
44
+ ],
45
+ 'jsx-quotes': ['error', 'prefer-double'],
46
+ '@eslint-react/no-children-for-each': 'off',
47
+ '@eslint-react/no-children-count': 'off',
48
+ '@eslint-react/no-children-map': 'off',
49
+ '@eslint-react/no-children-to-array': 'off',
50
+ '@eslint-react/no-class-component': 'error',
51
+ '@eslint-react/no-create-ref': 'error',
52
+ '@eslint-react/no-duplicate-key': 'error',
53
+ '@eslint-react/no-implicit-key': 'error',
54
+ '@eslint-react/no-leaked-conditional-rendering': 'error',
55
+ '@eslint-react/no-missing-component-display-name': 'warn',
56
+ '@eslint-react/no-missing-context-display-name': 'error',
57
+ '@eslint-react/no-unstable-context-value': 'error',
58
+ '@eslint-react/no-useless-fragment': 'error',
59
+ '@eslint-react/no-unused-props': 'error',
60
+ '@eslint-react/no-unnecessary-use-prefix': 'error',
61
+ '@eslint-react/prefer-shorthand-boolean': 'warn',
62
+ '@eslint-react/prefer-react-namespace-import': 'error',
63
+ '@eslint-react/dom/no-missing-button-type': 'error',
64
+ '@eslint-react/dom/no-missing-iframe-sandbox': 'error',
65
+ '@eslint-react/hooks-extra/no-unnecessary-use-callback': 'error',
66
+ '@eslint-react/hooks-extra/no-unnecessary-use-memo': 'error',
67
+ '@eslint-react/hooks-extra/prefer-use-state-lazy-initialization': 'error',
68
+ '@eslint-react/naming-convention/component-name': ['error', 'PascalCase'],
69
+ '@eslint-react/naming-convention/context-name': 'error',
70
+ '@eslint-react/naming-convention/filename-extension': ['warn', 'as-needed'],
71
+ '@eslint-react/naming-convention/use-state': 'error',
72
+ },
73
+ },
74
+ {
75
+ // Test files
76
+ files: [
77
+ '**/*.test.ts',
78
+ '**/*.test.tsx',
79
+ '**/*.test.js',
80
+ '**/*.test.jsx',
81
+ '**/*.spec.ts',
82
+ '**/*.spec.tsx',
83
+ '**/*.spec.js',
84
+ '**/*.spec.jsx',
85
+ '**/*.spec.cy.ts',
86
+ '**/*.spec.cy.tsx',
87
+ '**/*.spec.cy.js',
88
+ '**/*.spec.cy.jsx',
89
+ '**/*.spec.ct.ts',
90
+ '**/*.spec.ct.tsx',
91
+ '**/*.spec.ct.js',
92
+ '**/*.spec.ct.jsx',
93
+ ],
94
+ rules: {
95
+ '@eslint-react/no-unnecessary-use-prefix': 'off',
96
+ '@eslint-react/no-create-ref': 'off',
97
+ },
98
+ },
99
+ );
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@frontify/eslint-config-react",
3
- "version": "0.17.6",
3
+ "type": "module",
4
+ "version": "1.0.0",
4
5
  "author": "Frontify Developers <developers@frontify.com>",
5
6
  "license": "MIT",
6
7
  "repository": {
@@ -8,29 +9,30 @@
8
9
  "url": "https://github.com/Frontify/eslint-config",
9
10
  "directory": "packages/react"
10
11
  },
11
- "main": "index.js",
12
+ "main": "eslint.config.mjs",
12
13
  "files": [
13
- "index.js"
14
+ "eslint.config.mjs"
14
15
  ],
15
16
  "publishConfig": {
16
17
  "access": "public"
17
18
  },
18
19
  "peerDependencies": {
19
- "eslint": "^8.26.0",
20
+ "eslint": "^9.0.0",
20
21
  "prettier": "^3.0.0",
21
- "react": "^18.2.0"
22
+ "react": "^18 || ^19"
22
23
  },
23
24
  "dependencies": {
24
- "eslint-plugin-jsx-a11y": "^6.8.0",
25
- "eslint-plugin-react": "^7.34.1",
26
- "eslint-plugin-react-hooks": "^4.6.0",
27
- "@frontify/eslint-config-basic": "^0.20.5"
25
+ "@eslint-react/eslint-plugin": "^2.0.0-beta.23",
26
+ "eslint-plugin-jsx-a11y-x": "^0.1.1",
27
+ "globals": "^16.3.0",
28
+ "typescript-eslint": "^8.39.0",
29
+ "@frontify/eslint-config-basic": "^1.0.0"
28
30
  },
29
31
  "devDependencies": {
30
- "eslint": "^8.57.0",
31
- "prettier": "^3.2.5"
32
+ "eslint": "^9.32.0",
33
+ "prettier": "^3.6.2"
32
34
  },
33
35
  "scripts": {
34
- "lint": "eslint . --config=index.js"
36
+ "lint": "eslint ."
35
37
  }
36
38
  }
package/index.js DELETED
@@ -1,34 +0,0 @@
1
- /* (c) Copyright Frontify Ltd., all rights reserved. */
2
-
3
- module.exports = {
4
- extends: [
5
- 'plugin:react/recommended',
6
- 'plugin:react-hooks/recommended',
7
- 'plugin:jsx-a11y/strict',
8
- '@frontify/eslint-config-basic',
9
- ],
10
- rules: {
11
- 'jsx-quotes': ['error', 'prefer-double'],
12
- 'react/prop-types': 'off',
13
- 'react/jsx-uses-react': 'off', // React >=17 doesn't needed it anymore
14
- 'react/react-in-jsx-scope': 'off', // React >=17 doesn't needed it anymore
15
- 'react/jsx-no-useless-fragment': 'error',
16
- 'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
17
- 'react/jsx-no-comment-textnodes': 'warn',
18
- 'react/jsx-no-duplicate-props': 'warn',
19
- 'react/jsx-no-target-blank': 'warn',
20
- 'react/jsx-no-undef': 'error',
21
- 'react/jsx-pascal-case': [
22
- 'warn',
23
- {
24
- allowAllCaps: true,
25
- ignore: [],
26
- },
27
- ],
28
- 'react/no-danger-with-children': 'warn',
29
- 'react/no-direct-mutation-state': 'warn',
30
- 'react/no-is-mounted': 'warn',
31
- 'react/no-typos': 'error',
32
- 'react/require-render-return': 'error',
33
- },
34
- };