eslint-config-decent 1.5.0 → 2.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.
package/README.md CHANGED
@@ -9,40 +9,55 @@ A decent ESLint configuration for TypeScript projects.
9
9
  ```mjs
10
10
  // eslint.config.mjs
11
11
 
12
- import { defaultConfig } from 'eslint-config-decent';
13
- import tsEslint from 'typescript-eslint';
12
+ import { config } from 'eslint-config-decent';
14
13
 
15
- export default tsEslint.config(...defaultConfig());
14
+ export default config();
16
15
  ```
17
16
 
18
17
  ## Override parserOptions
19
18
 
20
- ````mjs
19
+ ```mjs
21
20
  // eslint.config.mjs
22
21
 
23
- import { defaultConfig } from 'eslint-config-decent';
24
- import tsEslint from 'typescript-eslint';
22
+ import { config } from 'eslint-config-decent';
25
23
 
26
- export default tsEslint.config(...defaultConfig({
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 { defaultConfig } from 'eslint-config-decent';
40
- import tsEslint from 'typescript-eslint';
38
+ import { config } from 'eslint-config-decent';
41
39
 
42
- export default tsEslint.config(...defaultConfig({
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
+ ```
46
61
 
47
62
  ## License
48
63
 
package/dist/index.cjs CHANGED
@@ -695,18 +695,10 @@ function defaultConfig(options) {
695
695
  ...tsEslint__default.configs.base.languageOptions
696
696
  }
697
697
  },
698
- ...tsEslint__default.configs.strictTypeChecked.map((config) => {
699
- return {
700
- ...config,
701
- files: ["**/*.ts", "**/*.tsx"]
702
- };
703
- }),
704
- ...tsEslint__default.configs.stylisticTypeChecked.map((config) => {
705
- return {
706
- ...config,
707
- files: ["**/*.ts", "**/*.tsx"]
708
- };
709
- }),
698
+ {
699
+ files: ["**/*.ts", "**/*.tsx"],
700
+ extends: [...tsEslint__default.configs.strictTypeChecked, ...tsEslint__default.configs.stylisticTypeChecked]
701
+ },
710
702
  {
711
703
  languageOptions,
712
704
  settings: {
@@ -765,10 +757,19 @@ function defaultConfig(options) {
765
757
  files: ["**/*.tests.ts", "tests/tests.ts"],
766
758
  ...configs$5.base
767
759
  },
760
+ {
761
+ name: "eslint-config-decent/cjs-and-esm-disable-ts-rules",
762
+ files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
763
+ extends: [tsEslint__default.configs.disableTypeChecked]
764
+ },
768
765
  prettier__default
769
766
  ];
770
767
  }
768
+ function config(options) {
769
+ return tsEslint__default.config(...defaultConfig(options));
770
+ }
771
771
 
772
+ exports.config = config;
772
773
  exports.defaultConfig = defaultConfig;
773
774
  exports.eslintConfigs = configs$9;
774
775
  exports.importConfigs = configs$7;
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,17 @@ interface DefaultConfigOptions {
39
39
  parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
40
40
  enableRequireExtensionRule?: boolean;
41
41
  }
42
+ /**
43
+ * Exports the default configuration to be passed to `tsEslint.config`. Use this if you want more control of typescript-eslint configuration output.
44
+ * @param {DefaultConfigOptions} options
45
+ * @returns Array of typescript-eslint configurations
46
+ */
42
47
  declare function defaultConfig(options?: DefaultConfigOptions): ConfigWithExtends[];
43
-
44
- export { type DefaultConfigOptions, 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, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
48
+ /**
49
+ * Exports eslint configurations. Use this if you do not need to explicitly import typescript-eslint in your project.
50
+ * @param options
51
+ * @returns An array of eslint configurations
52
+ */
53
+ declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
54
+
55
+ 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, 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,17 @@ interface DefaultConfigOptions {
39
39
  parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
40
40
  enableRequireExtensionRule?: boolean;
41
41
  }
42
+ /**
43
+ * Exports the default configuration to be passed to `tsEslint.config`. Use this if you want more control of typescript-eslint configuration output.
44
+ * @param {DefaultConfigOptions} options
45
+ * @returns Array of typescript-eslint configurations
46
+ */
42
47
  declare function defaultConfig(options?: DefaultConfigOptions): ConfigWithExtends[];
43
-
44
- export { type DefaultConfigOptions, 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, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
48
+ /**
49
+ * Exports eslint configurations. Use this if you do not need to explicitly import typescript-eslint in your project.
50
+ * @param options
51
+ * @returns An array of eslint configurations
52
+ */
53
+ declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
54
+
55
+ 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, 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,17 @@ interface DefaultConfigOptions {
39
39
  parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
40
40
  enableRequireExtensionRule?: boolean;
41
41
  }
42
+ /**
43
+ * Exports the default configuration to be passed to `tsEslint.config`. Use this if you want more control of typescript-eslint configuration output.
44
+ * @param {DefaultConfigOptions} options
45
+ * @returns Array of typescript-eslint configurations
46
+ */
42
47
  declare function defaultConfig(options?: DefaultConfigOptions): ConfigWithExtends[];
43
-
44
- export { type DefaultConfigOptions, 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, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
48
+ /**
49
+ * Exports eslint configurations. Use this if you do not need to explicitly import typescript-eslint in your project.
50
+ * @param options
51
+ * @returns An array of eslint configurations
52
+ */
53
+ declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
54
+
55
+ 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, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
package/dist/index.mjs CHANGED
@@ -676,18 +676,10 @@ function defaultConfig(options) {
676
676
  ...tsEslint.configs.base.languageOptions
677
677
  }
678
678
  },
679
- ...tsEslint.configs.strictTypeChecked.map((config) => {
680
- return {
681
- ...config,
682
- files: ["**/*.ts", "**/*.tsx"]
683
- };
684
- }),
685
- ...tsEslint.configs.stylisticTypeChecked.map((config) => {
686
- return {
687
- ...config,
688
- files: ["**/*.ts", "**/*.tsx"]
689
- };
690
- }),
679
+ {
680
+ files: ["**/*.ts", "**/*.tsx"],
681
+ extends: [...tsEslint.configs.strictTypeChecked, ...tsEslint.configs.stylisticTypeChecked]
682
+ },
691
683
  {
692
684
  languageOptions,
693
685
  settings: {
@@ -746,8 +738,16 @@ function defaultConfig(options) {
746
738
  files: ["**/*.tests.ts", "tests/tests.ts"],
747
739
  ...configs$5.base
748
740
  },
741
+ {
742
+ name: "eslint-config-decent/cjs-and-esm-disable-ts-rules",
743
+ files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
744
+ extends: [tsEslint.configs.disableTypeChecked]
745
+ },
749
746
  prettier
750
747
  ];
751
748
  }
749
+ function config(options) {
750
+ return tsEslint.config(...defaultConfig(options));
751
+ }
752
752
 
753
- 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 };
753
+ 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, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-decent",
3
- "version": "1.5.0",
3
+ "version": "2.0.0",
4
4
  "description": "A decent ESLint configuration",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -72,34 +72,34 @@
72
72
  "node": ">=20.11.0"
73
73
  },
74
74
  "dependencies": {
75
- "@eslint/js": "^9.7.0",
76
- "@typescript-eslint/utils": "8.0.0-alpha.46",
75
+ "@eslint/js": "^9.8.0",
76
+ "@typescript-eslint/utils": "8.0.0",
77
77
  "eslint-config-prettier": "^9.1.0",
78
- "eslint-plugin-import-x": "^3.0.1",
79
- "eslint-plugin-jsdoc": "^48.7.0",
78
+ "eslint-plugin-import-x": "^3.1.0",
79
+ "eslint-plugin-jsdoc": "^48.11.0",
80
80
  "eslint-plugin-jsx-a11y": "^6.9.0",
81
- "eslint-plugin-mocha": "^10.4.3",
81
+ "eslint-plugin-mocha": "^10.5.0",
82
82
  "eslint-plugin-prettier": "^5.2.1",
83
- "eslint-plugin-promise": "^6.4.0",
84
- "eslint-plugin-react": "^7.34.4",
83
+ "eslint-plugin-promise": "^7.0.0",
84
+ "eslint-plugin-react": "^7.35.0",
85
85
  "eslint-plugin-react-hooks": "^4.6.2",
86
86
  "eslint-plugin-security": "^3.0.1",
87
87
  "eslint-plugin-testing-library": "^6.2.2",
88
- "eslint-plugin-unicorn": "^54.0.0",
89
- "globals": "^15.8.0",
90
- "typescript-eslint": "8.0.0-alpha.46"
88
+ "eslint-plugin-unicorn": "^55.0.0",
89
+ "globals": "^15.9.0",
90
+ "typescript-eslint": "8.0.0"
91
91
  },
92
92
  "devDependencies": {
93
- "@swc/core": "1.7.0",
94
- "@types/node": ">=20",
95
- "eslint": "^9.7.0",
96
- "husky": "^9.1.1",
93
+ "@swc/core": "1.7.5",
94
+ "@types/node": ">=22",
95
+ "eslint": "^9.8.0",
96
+ "husky": "^9.1.4",
97
97
  "lint-staged": "^15.2.7",
98
98
  "markdownlint-cli": "^0.41.0",
99
99
  "npm-run-all": "^4.1.5",
100
100
  "pinst": "^3.0.0",
101
101
  "prettier": "^3.3.3",
102
- "typescript": "^5.5.3",
102
+ "typescript": "^5.5.4",
103
103
  "unbuild": "2.0.0"
104
104
  },
105
105
  "overrides": {
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,6 +31,11 @@ export interface DefaultConfigOptions {
30
31
  enableRequireExtensionRule?: boolean;
31
32
  }
32
33
 
34
+ /**
35
+ * Exports the default configuration to be passed to `tsEslint.config`. Use this if you want more control of typescript-eslint configuration output.
36
+ * @param {DefaultConfigOptions} options
37
+ * @returns Array of typescript-eslint configurations
38
+ */
33
39
  export function defaultConfig(options?: DefaultConfigOptions): ConfigWithExtends[] {
34
40
  const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
35
41
  const languageOptions: ConfigWithExtends['languageOptions'] = {
@@ -56,18 +62,10 @@ export function defaultConfig(options?: DefaultConfigOptions): ConfigWithExtends
56
62
  ...tsEslint.configs.base.languageOptions,
57
63
  },
58
64
  },
59
- ...tsEslint.configs.strictTypeChecked.map((config) => {
60
- return {
61
- ...config,
62
- files: ['**/*.ts', '**/*.tsx'],
63
- };
64
- }),
65
- ...tsEslint.configs.stylisticTypeChecked.map((config) => {
66
- return {
67
- ...config,
68
- files: ['**/*.ts', '**/*.tsx'],
69
- };
70
- }),
65
+ {
66
+ files: ['**/*.ts', '**/*.tsx'],
67
+ extends: [...tsEslint.configs.strictTypeChecked, ...tsEslint.configs.stylisticTypeChecked],
68
+ },
71
69
  {
72
70
  languageOptions,
73
71
  settings: {
@@ -127,6 +125,20 @@ export function defaultConfig(options?: DefaultConfigOptions): ConfigWithExtends
127
125
 
128
126
  ...mochaConfigs.base,
129
127
  },
128
+ {
129
+ name: 'eslint-config-decent/cjs-and-esm-disable-ts-rules',
130
+ files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
131
+ extends: [tsEslint.configs.disableTypeChecked],
132
+ },
130
133
  prettier,
131
134
  ];
132
135
  }
136
+
137
+ /**
138
+ * Exports eslint configurations. Use this if you do not need to explicitly import typescript-eslint in your project.
139
+ * @param options
140
+ * @returns An array of eslint configurations
141
+ */
142
+ export function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray {
143
+ return tsEslint.config(...defaultConfig(options));
144
+ }