@mscharley/eslint-config 4.0.2 → 4.0.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log - @mscharley/eslint-config
2
2
 
3
+ ## 4.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 7d2169b: Prevent better support for linting JS files
8
+ - 4872523: Apply testing fixes to **mocks** as well as **utils**
9
+
3
10
  ## 4.0.2
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -45,6 +45,14 @@ If using Prettier to format files other than TypeScript and JavaScript files the
45
45
  **/*.js
46
46
  ```
47
47
 
48
+ ### Usage in JavaScript projects
49
+
50
+ ```
51
+ Parsing error: [...]/configFile.js was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject
52
+ ```
53
+
54
+ If you get messages like this, you can disable type-checked rules using the `disableTypeCheckedRules()` helper function exported by this module. This takes a list of file paths and returns a single configuration object. This takes into account all type checked rules enabled by this configuration and is a superset of the helper configuration provided by `typescript-eslint` for a similar purpose.
55
+
48
56
  [gh-contrib]: https://github.com/mscharley/node-presets/graphs/contributors
49
57
  [gh-issues]: https://github.com/mscharley/node-presets/issues
50
58
  [license]: https://github.com/mscharley/node-presets/blob/main/LICENSE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mscharley/eslint-config",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "type": "module",
5
5
  "module": "./rules/index.js",
6
6
  "exports": {
package/rules/index.js CHANGED
@@ -1,9 +1,9 @@
1
+ import typescript, { disableTypeCheckedRules } from './typescript.js';
1
2
  import eslint from './eslint.js';
2
3
  import node from './node.js';
3
4
  import react from './react.js';
4
5
  import stylistic from '@stylistic/eslint-plugin';
5
6
  import testing from './testing.js';
6
- import typescript from './typescript.js';
7
7
 
8
8
  export const configs = {
9
9
  recommended: [
@@ -37,4 +37,6 @@ export const withStyles = () => [
37
37
  },
38
38
  ];
39
39
 
40
- export default { configs, withStyles };
40
+ export { disableTypeCheckedRules };
41
+
42
+ export default { configs, disableTypeCheckedRules, withStyles };
package/rules/testing.js CHANGED
@@ -37,7 +37,10 @@ export default [
37
37
  },
38
38
  },
39
39
  {
40
- files: ['**/__utils__/**/*.ts'],
40
+ files: [
41
+ '**/__mocks__/**/*.{ts,js,tsx,jsx}',
42
+ '**/__utils__/**/*.{ts,js,tsx,jsx}',
43
+ ],
41
44
  rules: {
42
45
  'jest/no-export': 'off',
43
46
  },
@@ -1,5 +1,15 @@
1
1
  import { configs as tseslint } from 'typescript-eslint';
2
2
 
3
+ export const disableTypeCheckedRules = (...files) => ({
4
+ files,
5
+ ...tseslint.disableTypeChecked,
6
+ rules: {
7
+ ...tseslint.disableTypeChecked.rules,
8
+ '@typescript-eslint/explicit-function-return-type': 'off',
9
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
10
+ },
11
+ });
12
+
3
13
  /** @type import('eslint').Config[] */
4
14
  export default [
5
15
  ...tseslint.recommendedTypeChecked,
@@ -11,9 +21,6 @@ export default [
11
21
  },
12
22
  },
13
23
  {
14
- files: [
15
- '**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts',
16
- ],
17
24
  rules: {
18
25
  '@typescript-eslint/no-deprecated': 'warn',
19
26
  '@typescript-eslint/array-type': [
@@ -128,8 +135,13 @@ export default [
128
135
  '@typescript-eslint/no-unused-vars': [
129
136
  'warn',
130
137
  {
138
+ args: 'all',
131
139
  argsIgnorePattern: '^_',
140
+ caughtErrors: 'all',
141
+ caughtErrorsIgnorePattern: '^_',
142
+ destructuredArrayIgnorePattern: '^_',
132
143
  varsIgnorePattern: '^_',
144
+ ignoreRestSiblings: true,
133
145
  },
134
146
  ],
135
147
  '@typescript-eslint/no-unnecessary-boolean-literal-compare': [
@@ -174,4 +186,5 @@ export default [
174
186
  '@typescript-eslint/switch-exhaustiveness-check': 'error',
175
187
  },
176
188
  },
189
+ disableTypeCheckedRules('*.config.js'),
177
190
  ];