@dfds-ui/eslint-config 2.0.29-alpha.9a0ea182 → 2.0.29-alpha.aacdeb08

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 (2) hide show
  1. package/eslint.config.js +129 -80
  2. package/package.json +2 -2
package/eslint.config.js CHANGED
@@ -1,89 +1,138 @@
1
- // ESLint 9 flat config style exported via CommonJS for consumers still using require()
2
- // This replaces the legacy object config with an array.
1
+ module.exports = {
2
+ root: true,
3
3
 
4
- const js = require('@eslint/js')
5
- const tsPlugin = require('@typescript-eslint/eslint-plugin')
6
- const tsParser = require('@typescript-eslint/parser')
7
- const react = require('eslint-plugin-react')
8
- const reactHooks = require('eslint-plugin-react-hooks')
9
- const importPlugin = require('eslint-plugin-import')
4
+ parser: '@typescript-eslint/parser',
5
+ extends: ['eslint:recommended'],
10
6
 
11
- module.exports = [
12
- {
13
- ignores: [
14
- '**/dist/**',
15
- '**/coverage/**',
16
- '**/storybook-static/**',
17
- '**/*.d.ts',
18
- 'node_modules/**',
7
+ rules: {
8
+ 'no-irregular-whitespace': [
9
+ 'warn',
10
+ {
11
+ skipComments: true,
12
+ skipRegExps: true,
13
+ skipTemplates: true,
14
+ },
19
15
  ],
16
+ 'no-extra-boolean-cast': 'off', // TODO: this will trigger in a few files. Consider enabling
20
17
  },
21
- js.configs.recommended,
22
- {
23
- files: ['**/*.ts', '**/*.tsx'],
24
- languageOptions: {
25
- parser: tsParser,
26
- parserOptions: {
27
- ecmaVersion: 'latest',
28
- sourceType: 'module',
29
- ecmaFeatures: { jsx: true },
30
- },
18
+
19
+ settings: {
20
+ react: {
21
+ version: 'detect',
31
22
  },
32
- plugins: {
33
- '@typescript-eslint': tsPlugin,
34
- react,
35
- 'react-hooks': reactHooks,
36
- import: importPlugin,
23
+ 'import/extensions': ['.ts', '.tsx', '.d.ts', '.js', '.jsx'],
24
+
25
+ 'import/parsers': {
26
+ '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
37
27
  },
38
- settings: {
39
- react: { version: 'detect' },
40
- 'import/resolver': { typescript: { alwaysTryTypes: true } },
28
+
29
+ 'import/resolver': {
30
+ typescript: { alwaysTryTypes: true },
41
31
  },
42
- rules: {
43
- 'no-irregular-whitespace': ['warn', { skipComments: true, skipRegExps: true, skipTemplates: true }],
44
- 'no-extra-boolean-cast': 'off',
45
- 'prefer-rest-params': 'off',
46
- 'no-console': 'warn',
47
- 'no-restricted-imports': ['error', { patterns: ['../**/src'] }],
48
- 'sort-imports': 'off',
49
- 'import/order': 'off',
50
- 'import/no-extraneous-dependencies': 'error',
51
- 'import/no-named-as-default-member': 'off',
52
- 'import/no-named-as-default': 'off',
53
- 'import/default': 'off',
54
- 'import/export': 'error',
55
- 'import/no-unresolved': 'error',
56
- 'import/namespace': ['error', { allowComputed: true }],
57
- '@typescript-eslint/explicit-function-return-type': 'off',
58
- '@typescript-eslint/member-delimiter-style': [
59
- 'warn',
60
- { multiline: { delimiter: 'none', requireLast: false }, singleline: { delimiter: 'semi', requireLast: false } },
32
+ },
33
+
34
+ overrides: [
35
+ // typescript overrides
36
+ {
37
+ files: ['*.ts', '*.tsx'],
38
+ plugins: ['@typescript-eslint', 'react-hooks', 'simple-import-sort', 'import', 'deprecation'],
39
+ extends: [
40
+ 'plugin:@typescript-eslint/recommended',
41
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
42
+ 'plugin:react/recommended',
61
43
  ],
62
- '@typescript-eslint/interface-name-prefix': ['warn', { prefixWithI: 'always' }],
63
- '@typescript-eslint/no-use-before-define': 'off',
64
- '@typescript-eslint/no-explicit-any': 'off',
65
- '@typescript-eslint/type-annotation-spacing': 'warn',
66
- '@typescript-eslint/explicit-module-boundary-types': 'off',
67
- '@typescript-eslint/no-unsafe-argument': 'off',
68
- '@typescript-eslint/no-unsafe-assignment': 'off',
69
- '@typescript-eslint/no-unsafe-call': 'off',
70
- '@typescript-eslint/no-unsafe-member-access': 'off',
71
- '@typescript-eslint/no-unsafe-return': 'off',
72
- '@typescript-eslint/restrict-template-expressions': 'off',
73
- '@typescript-eslint/no-misused-promises': 'error',
74
- '@typescript-eslint/no-unused-vars': ['off'],
75
- 'react/display-name': 'off',
76
- 'react/prop-types': 'off',
77
- 'react-hooks/rules-of-hooks': 'error',
78
- 'react-hooks/exhaustive-deps': 'warn',
79
- 'react/no-unescaped-entities': 'off',
80
- 'react/no-unknown-property': ['error', { ignore: ['css'] }],
81
- 'react/jsx-no-literals': 'off',
82
- // deprecation plugin temporarily removed pending ESLint 9 compatible release
44
+ rules: {
45
+ 'prefer-rest-params': 'off',
46
+ 'no-console': 'warn',
47
+ // prevent import of modules from other packages in the workspace using relative paths
48
+ 'no-restricted-imports': [
49
+ 'error',
50
+ {
51
+ patterns: ['../**/src'],
52
+ },
53
+ ],
54
+
55
+ // Ordering of imports
56
+ 'sort-imports': 'off', // turned off since we use simple-import-sort to handle ordering
57
+ 'import/order': 'off', // turned off since we use simple-import-sort to handle ordering
58
+ 'simple-import-sort/sort': 'off',
59
+ 'import/no-extraneous-dependencies': 'error',
60
+ 'import/no-named-as-default-member': 'off', // TODO: consider enable this?
61
+ 'import/no-named-as-default': 'off', // TODO: consider enable this?
62
+ 'import/default': 'off',
63
+ 'import/export': 'error',
64
+ 'import/no-unresolved': ['error'],
65
+ 'import/namespace': ['error', { allowComputed: true }],
66
+
67
+ '@typescript-eslint/explicit-function-return-type': 'off',
68
+ '@typescript-eslint/member-delimiter-style': [
69
+ 'warn',
70
+ {
71
+ multiline: {
72
+ delimiter: 'none',
73
+ requireLast: false,
74
+ },
75
+ singleline: {
76
+ delimiter: 'semi',
77
+ requireLast: false,
78
+ },
79
+ },
80
+ ],
81
+ '@typescript-eslint/interface-name-prefix': ['warn', { prefixWithI: 'always' }],
82
+ '@typescript-eslint/no-use-before-define': 'off', // TODO: maybe enable this?
83
+ '@typescript-eslint/no-explicit-any': 'off',
84
+ //TODO: use naming-convention
85
+ //'@typescript-eslint/camelcase': 'warn',
86
+ '@typescript-eslint/type-annotation-spacing': 'warn',
87
+ //TODO: use ban-ts-comment
88
+ //'@typescript-eslint/ban-ts-ignore': 'error',
89
+
90
+ '@typescript-eslint/explicit-module-boundary-types': 'off', // TODO: TS4 consider enabling
91
+ '@typescript-eslint/no-unsafe-argument': 'off', // TODO: Consider eabling
92
+ '@typescript-eslint/no-unsafe-assignment': 'off', // TODO: TS4 consider enabling
93
+ '@typescript-eslint/no-unsafe-call': 'off', // TODO: TS4 consider enabling
94
+ '@typescript-eslint/no-unsafe-member-access': 'off', // TODO: TS4 consider enabling
95
+ '@typescript-eslint/no-unsafe-return': 'off', // TODO: TS4 consider enabling
96
+ '@typescript-eslint/restrict-template-expressions': 'off',
97
+ '@typescript-eslint/no-misused-promises': 'error',
98
+
99
+ // TODO: enable this again when babel-lint supports it
100
+ // Using babel-eslint (v11 beta ATTOW) as the parser have issues with this rule so it's disabled
101
+ // The rule is currently covered by 'noUnusedLocals' in tsconfig.json
102
+ // https://github.com/babel/babel-eslint/milestone/1
103
+ '@typescript-eslint/no-unused-vars': [
104
+ 'off',
105
+ {
106
+ vars: 'all',
107
+ args: 'after-used',
108
+ ignoreRestSiblings: false,
109
+ argsIgnorePattern: '^_',
110
+ },
111
+ ],
112
+
113
+ 'react/display-name': 'off',
114
+ 'react/prop-types': 'off',
115
+ 'react-hooks/rules-of-hooks': 'error',
116
+ 'react-hooks/exhaustive-deps': 'warn',
117
+ 'react/no-unescaped-entities': 'off', // TODO: maybe enable this?
118
+ 'react/no-unknown-property': ['error', { ignore: ['css'] }],
119
+ 'react/jsx-no-literals': 'off', // TODO: maybe enable this?
120
+
121
+ 'deprecation/deprecation': 'warn',
122
+ },
83
123
  },
84
- },
85
- {
86
- files: ['**/*.js'],
87
- languageOptions: { ecmaVersion: 'latest', sourceType: 'module' },
88
- },
89
- ]
124
+ // javascript overrides
125
+ {
126
+ files: ['*.js'],
127
+ env: {
128
+ node: true,
129
+ },
130
+ },
131
+ {
132
+ files: ['scripts/jest/setup.js'],
133
+ env: {
134
+ browser: true,
135
+ },
136
+ },
137
+ ],
138
+ }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "2.0.29-alpha.9a0ea182",
8
+ "version": "2.0.29-alpha.aacdeb08",
9
9
  "dependencies": {
10
10
  "@typescript-eslint/eslint-plugin": "^5.40.1",
11
11
  "@typescript-eslint/parser": "^5.40.1",
@@ -22,5 +22,5 @@
22
22
  "eslint-plugin-simple-import-sort": "^8.0.0",
23
23
  "prettier": "2.7.1"
24
24
  },
25
- "gitHead": "9a0ea1821df447249363a38ea548ce565163e1c3"
25
+ "gitHead": "aacdeb08c6f57b4e911907e646cf4b19c13811f0"
26
26
  }