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 CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 James Geurts
3
+ Copyright (c) James Geurts
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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 { 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
+ ];
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
- function defaultConfig(options) {
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
- 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 };
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
- 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 };
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
- 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 };
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
- function defaultConfig(options) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-decent",
3
- "version": "1.6.0",
3
+ "version": "2.0.1",
4
4
  "description": "A decent ESLint configuration",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
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
- export function defaultConfig(options?: DefaultConfigOptions): ConfigWithExtends[] {
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
+ }