eslint-config-decent 1.6.0 → 2.0.1
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/LICENSE +1 -1
- package/README.md +40 -13
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +19 -4
- package/dist/index.d.mts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.mjs +6 -2
- package/package.json +1 -1
- package/src/index.ts +21 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -9,40 +9,67 @@ A decent ESLint configuration for TypeScript projects.
|
|
|
9
9
|
```mjs
|
|
10
10
|
// eslint.config.mjs
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
import tsEslint from 'typescript-eslint';
|
|
12
|
+
import { config } from 'eslint-config-decent';
|
|
14
13
|
|
|
15
|
-
export default
|
|
14
|
+
export default config();
|
|
16
15
|
```
|
|
17
16
|
|
|
18
17
|
## Override parserOptions
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
```mjs
|
|
21
20
|
// eslint.config.mjs
|
|
22
21
|
|
|
23
|
-
import {
|
|
24
|
-
import tsEslint from 'typescript-eslint';
|
|
22
|
+
import { config } from 'eslint-config-decent';
|
|
25
23
|
|
|
26
|
-
export default
|
|
24
|
+
export default config({
|
|
27
25
|
projectService: {
|
|
28
26
|
allowDefaultProject: ['./*.{js,cjs,mjs}'],
|
|
29
27
|
defaultProject: 'tsconfig.json',
|
|
30
28
|
},
|
|
31
29
|
tsconfigRootDir: import.meta.dirname,
|
|
32
|
-
})
|
|
30
|
+
});
|
|
31
|
+
```
|
|
33
32
|
|
|
34
33
|
## Disable require-extensions rules
|
|
35
34
|
|
|
36
35
|
```mjs
|
|
37
36
|
// eslint.config.mjs
|
|
38
37
|
|
|
39
|
-
import {
|
|
40
|
-
import tsEslint from 'typescript-eslint';
|
|
38
|
+
import { config } from 'eslint-config-decent';
|
|
41
39
|
|
|
42
|
-
export default
|
|
40
|
+
export default config({
|
|
43
41
|
enableRequireExtensions: false,
|
|
44
|
-
})
|
|
45
|
-
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Override a rule
|
|
46
|
+
|
|
47
|
+
```mjs
|
|
48
|
+
// eslint.config.mjs
|
|
49
|
+
|
|
50
|
+
import { config } from 'eslint-config-decent';
|
|
51
|
+
|
|
52
|
+
export default [
|
|
53
|
+
...config(),
|
|
54
|
+
{
|
|
55
|
+
files: ['**/*.ts'],
|
|
56
|
+
rules: {
|
|
57
|
+
'@typescript-eslint/no-confusing-void-expression': 'off',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Use typescript-eslint config
|
|
64
|
+
|
|
65
|
+
```mjs
|
|
66
|
+
// eslint.config.mjs
|
|
67
|
+
|
|
68
|
+
import { tsEslintConfig } from 'eslint-config-decent';
|
|
69
|
+
import tsEslint from 'typescript-eslint';
|
|
70
|
+
|
|
71
|
+
export default tsEslint(...tsEslintConfig());
|
|
72
|
+
```
|
|
46
73
|
|
|
47
74
|
## License
|
|
48
75
|
|
package/dist/index.cjs
CHANGED
|
@@ -671,7 +671,8 @@ const configs = {
|
|
|
671
671
|
base
|
|
672
672
|
};
|
|
673
673
|
|
|
674
|
-
|
|
674
|
+
const defaultConfig = tsEslintConfig;
|
|
675
|
+
function tsEslintConfig(options) {
|
|
675
676
|
const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
|
|
676
677
|
const languageOptions = {
|
|
677
678
|
globals: {
|
|
@@ -765,7 +766,11 @@ function defaultConfig(options) {
|
|
|
765
766
|
prettier__default
|
|
766
767
|
];
|
|
767
768
|
}
|
|
769
|
+
function config(options) {
|
|
770
|
+
return tsEslint__default.config(...tsEslintConfig(options));
|
|
771
|
+
}
|
|
768
772
|
|
|
773
|
+
exports.config = config;
|
|
769
774
|
exports.defaultConfig = defaultConfig;
|
|
770
775
|
exports.eslintConfigs = configs$9;
|
|
771
776
|
exports.importConfigs = configs$7;
|
|
@@ -773,5 +778,6 @@ exports.jsdocConfigs = configs$6;
|
|
|
773
778
|
exports.promiseConfigs = configs$4;
|
|
774
779
|
exports.reactConfigs = configs$3;
|
|
775
780
|
exports.securityConfigs = configs$2;
|
|
781
|
+
exports.tsEslintConfig = tsEslintConfig;
|
|
776
782
|
exports.typescriptEslintConfigs = configs$1;
|
|
777
783
|
exports.unicornConfigs = configs;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConfigWithExtends } from 'typescript-eslint';
|
|
2
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
import { ConfigWithExtends } from 'typescript-eslint';
|
|
3
3
|
|
|
4
4
|
declare const configs$7: {
|
|
5
5
|
base: TSESLint.FlatConfig.Config;
|
|
@@ -39,6 +39,21 @@ interface DefaultConfigOptions {
|
|
|
39
39
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
40
40
|
enableRequireExtensionRule?: boolean;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use `tsEslintConfig` instead
|
|
44
|
+
*/
|
|
45
|
+
declare const defaultConfig: typeof tsEslintConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Exports the default configuration to be passed to `tsEslint.config`. Use this if you want more control of typescript-eslint configuration output.
|
|
48
|
+
* @param {DefaultConfigOptions} options
|
|
49
|
+
* @returns Array of typescript-eslint configurations
|
|
50
|
+
*/
|
|
51
|
+
declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtends[];
|
|
52
|
+
/**
|
|
53
|
+
* Exports eslint configurations. Use this if you do not need to explicitly import typescript-eslint in your project.
|
|
54
|
+
* @param options
|
|
55
|
+
* @returns An array of eslint configurations
|
|
56
|
+
*/
|
|
57
|
+
declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
|
|
58
|
+
|
|
59
|
+
export { type DefaultConfigOptions, config, defaultConfig, configs$7 as eslintConfigs, configs$6 as importConfigs, configs$5 as jsdocConfigs, configs$4 as promiseConfigs, configs$3 as reactConfigs, configs$2 as securityConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConfigWithExtends } from 'typescript-eslint';
|
|
2
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
import { ConfigWithExtends } from 'typescript-eslint';
|
|
3
3
|
|
|
4
4
|
declare const configs$7: {
|
|
5
5
|
base: TSESLint.FlatConfig.Config;
|
|
@@ -39,6 +39,21 @@ interface DefaultConfigOptions {
|
|
|
39
39
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
40
40
|
enableRequireExtensionRule?: boolean;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use `tsEslintConfig` instead
|
|
44
|
+
*/
|
|
45
|
+
declare const defaultConfig: typeof tsEslintConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Exports the default configuration to be passed to `tsEslint.config`. Use this if you want more control of typescript-eslint configuration output.
|
|
48
|
+
* @param {DefaultConfigOptions} options
|
|
49
|
+
* @returns Array of typescript-eslint configurations
|
|
50
|
+
*/
|
|
51
|
+
declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtends[];
|
|
52
|
+
/**
|
|
53
|
+
* Exports eslint configurations. Use this if you do not need to explicitly import typescript-eslint in your project.
|
|
54
|
+
* @param options
|
|
55
|
+
* @returns An array of eslint configurations
|
|
56
|
+
*/
|
|
57
|
+
declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
|
|
58
|
+
|
|
59
|
+
export { type DefaultConfigOptions, config, defaultConfig, configs$7 as eslintConfigs, configs$6 as importConfigs, configs$5 as jsdocConfigs, configs$4 as promiseConfigs, configs$3 as reactConfigs, configs$2 as securityConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConfigWithExtends } from 'typescript-eslint';
|
|
2
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
import { ConfigWithExtends } from 'typescript-eslint';
|
|
3
3
|
|
|
4
4
|
declare const configs$7: {
|
|
5
5
|
base: TSESLint.FlatConfig.Config;
|
|
@@ -39,6 +39,21 @@ interface DefaultConfigOptions {
|
|
|
39
39
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
40
40
|
enableRequireExtensionRule?: boolean;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use `tsEslintConfig` instead
|
|
44
|
+
*/
|
|
45
|
+
declare const defaultConfig: typeof tsEslintConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Exports the default configuration to be passed to `tsEslint.config`. Use this if you want more control of typescript-eslint configuration output.
|
|
48
|
+
* @param {DefaultConfigOptions} options
|
|
49
|
+
* @returns Array of typescript-eslint configurations
|
|
50
|
+
*/
|
|
51
|
+
declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtends[];
|
|
52
|
+
/**
|
|
53
|
+
* Exports eslint configurations. Use this if you do not need to explicitly import typescript-eslint in your project.
|
|
54
|
+
* @param options
|
|
55
|
+
* @returns An array of eslint configurations
|
|
56
|
+
*/
|
|
57
|
+
declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
|
|
58
|
+
|
|
59
|
+
export { type DefaultConfigOptions, config, defaultConfig, configs$7 as eslintConfigs, configs$6 as importConfigs, configs$5 as jsdocConfigs, configs$4 as promiseConfigs, configs$3 as reactConfigs, configs$2 as securityConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/dist/index.mjs
CHANGED
|
@@ -652,7 +652,8 @@ const configs = {
|
|
|
652
652
|
base
|
|
653
653
|
};
|
|
654
654
|
|
|
655
|
-
|
|
655
|
+
const defaultConfig = tsEslintConfig;
|
|
656
|
+
function tsEslintConfig(options) {
|
|
656
657
|
const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
|
|
657
658
|
const languageOptions = {
|
|
658
659
|
globals: {
|
|
@@ -746,5 +747,8 @@ function defaultConfig(options) {
|
|
|
746
747
|
prettier
|
|
747
748
|
];
|
|
748
749
|
}
|
|
750
|
+
function config(options) {
|
|
751
|
+
return tsEslint.config(...tsEslintConfig(options));
|
|
752
|
+
}
|
|
749
753
|
|
|
750
|
-
export { defaultConfig, configs$9 as eslintConfigs, configs$7 as importConfigs, configs$6 as jsdocConfigs, configs$4 as promiseConfigs, configs$3 as reactConfigs, configs$2 as securityConfigs, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
|
754
|
+
export { config, defaultConfig, configs$9 as eslintConfigs, configs$7 as importConfigs, configs$6 as jsdocConfigs, configs$4 as promiseConfigs, configs$3 as reactConfigs, configs$2 as securityConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import eslint from '@eslint/js';
|
|
2
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
3
|
import prettier from 'eslint-plugin-prettier/recommended';
|
|
3
4
|
import globals from 'globals';
|
|
4
5
|
import tsEslint, { type ConfigWithExtends } from 'typescript-eslint';
|
|
@@ -30,7 +31,17 @@ export interface DefaultConfigOptions {
|
|
|
30
31
|
enableRequireExtensionRule?: boolean;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use `tsEslintConfig` instead
|
|
36
|
+
*/
|
|
37
|
+
export const defaultConfig = tsEslintConfig;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Exports the default configuration to be passed to `tsEslint.config`. Use this if you want more control of typescript-eslint configuration output.
|
|
41
|
+
* @param {DefaultConfigOptions} options
|
|
42
|
+
* @returns Array of typescript-eslint configurations
|
|
43
|
+
*/
|
|
44
|
+
export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtends[] {
|
|
34
45
|
const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
|
|
35
46
|
const languageOptions: ConfigWithExtends['languageOptions'] = {
|
|
36
47
|
globals: {
|
|
@@ -127,3 +138,12 @@ export function defaultConfig(options?: DefaultConfigOptions): ConfigWithExtends
|
|
|
127
138
|
prettier,
|
|
128
139
|
];
|
|
129
140
|
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Exports eslint configurations. Use this if you do not need to explicitly import typescript-eslint in your project.
|
|
144
|
+
* @param options
|
|
145
|
+
* @returns An array of eslint configurations
|
|
146
|
+
*/
|
|
147
|
+
export function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray {
|
|
148
|
+
return tsEslint.config(...tsEslintConfig(options));
|
|
149
|
+
}
|