@kristijorgji/eslint-config-typescript 1.1.0 → 1.2.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/README.md CHANGED
@@ -19,6 +19,9 @@ export default createTypescriptConfig({
19
19
  tsconfigRootDir: import.meta.dirname,
20
20
  // Prefer your repo's .prettierrc as the single source of truth:
21
21
  prettier: 'prettierrc',
22
+ // Opt-in groups (default off):
23
+ codeQuality: true,
24
+ explicitTypes: true,
22
25
  });
23
26
  ```
24
27
 
@@ -28,10 +31,37 @@ export default createTypescriptConfig({
28
31
  | --- | --- |
29
32
  | `files` | Glob patterns (default `**/*.{ts,tsx}`) |
30
33
  | `tsconfigRootDir` | Enables type-aware rules via `createTypedLintConfig` |
31
- | `prettier` | `true` (default, embeds package defaults), `'prettierrc'` (defer to the consumer's Prettier config file), a Prettier options object (replaces defaults), or `false` |
34
+ | `prettier` | `true` (default, embeds package defaults), `'prettierrc'` (defer to the adopter's Prettier config file), a Prettier options object (replaces defaults), or `false` |
32
35
  | `ignores` | Extra ignore globs |
33
36
  | `importOrder` | Options for `import-x/order`, shallow-merged over package defaults; `false` disables the rule |
34
37
  | `sortImports` | Options for `sort-imports`, shallow-merged over package defaults; `false` disables the rule |
38
+ | `codeQuality` | Opt-in (`true` or `{ duplication?, unusedSymbols? }`). Enables the sonarjs in-file duplication subset, `unused-imports/no-unused-imports`, and `@typescript-eslint/no-unused-private-class-members`. Default off. |
39
+ | `explicitTypes` | Opt-in (`true` or per-rule toggles). Enables `consistent-type-assertions`, `consistent-type-imports`, `explicit-module-boundary-types`, and `explicit-function-return-type`. Default off. For React apps, prefer `@kristijorgji/eslint-config-react-typescript`, which turns `explicit-function-return-type` off for `.tsx`/`.jsx` when that rule is enabled (JSX return types are inferred). For non-React presets, pass `functionReturnType: false` or add a file-scoped override if you want the same relaxation. |
40
+
41
+ ### Migration from hand-rolled configs
42
+
43
+ If you previously enabled sonarjs duplication rules, `unused-imports`, and the
44
+ `@typescript-eslint` explicit/consistent typing rules locally, replace that
45
+ block with `codeQuality: true` and `explicitTypes: true`. For presets that do
46
+ not go through this factory (for example React Native), compose the standalone
47
+ blocks:
48
+
49
+ ```js
50
+ import {
51
+ createCodeQualityConfig,
52
+ createExplicitTypesConfig,
53
+ } from '@kristijorgji/eslint-config-typescript';
54
+
55
+ export default [
56
+ createCodeQualityConfig(),
57
+ createExplicitTypesConfig(),
58
+ // Optional: relax internal return types in JSX files (createReactConfig does this).
59
+ {
60
+ files: ['**/*.{tsx,jsx}'],
61
+ rules: { '@typescript-eslint/explicit-function-return-type': 'off' },
62
+ },
63
+ ];
64
+ ```
35
65
 
36
66
  ### Named exports / subpaths
37
67
 
@@ -41,12 +71,21 @@ export default createTypescriptConfig({
41
71
  - `./ignores` — default ignore block
42
72
 
43
73
  Also exported: `createImportOrderRules`, `importOrderRules`,
44
- `defaultImportXOrderOptions`, `defaultSortImportsOptions`.
74
+ `defaultImportXOrderOptions`, `defaultSortImportsOptions`,
75
+ `createCodeQualityConfig`, `createExplicitTypesConfig`.
45
76
 
46
77
  ### Plugin rule placement
47
78
 
48
- This package enables **`kj/no-pure-type-alias` only**. JSX prop order
79
+ This package enables **`kj/no-pure-type-alias` only** from the plugin set
80
+ (plus optional `codeQuality` / `explicitTypes` groups above). JSX prop order
49
81
  (`perfectionist/sort-jsx-props`), single-export barrels, and component extraction
50
82
  live in `@kristijorgji/eslint-config-react-typescript`.
51
83
 
84
+ ### Rule inventory snapshots
85
+
86
+ `tests/rule-inventory.test.ts` snapshots the sorted enabled rule IDs (grouped by
87
+ plugin prefix) for the default factory and for `codeQuality` + `explicitTypes`
88
+ on. Failures on upstream plugin bumps are an **intentional review gate** —
89
+ update the snapshot only after confirming the new rules are wanted.
90
+
52
91
  Vendored from [`eslint-config-typescript@702410cb`](https://github.com/kristijorgji/eslint-config-typescript/commit/702410cb03fb6f506d148cde7aa94d8a844d3621) and rewritten as an ESM flat-config factory.
package/dist/base.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import type { Linter } from 'eslint';
2
+ import { type CodeQualityOptions } from './code-quality.js';
3
+ import { type ExplicitTypesOptions } from './explicit-types.js';
2
4
  import { type ImportXOrderOptions, type SortImportsOptions } from './import-order.js';
3
5
  import { type PrettierSetting } from './prettier.js';
4
6
  export interface BaseRulesOptions {
@@ -12,6 +14,16 @@ export interface BaseRulesOptions {
12
14
  importOrder?: false | ImportXOrderOptions;
13
15
  /** `sort-imports` options (shallow merge). `false` disables the rule. */
14
16
  sortImports?: false | SortImportsOptions;
17
+ /**
18
+ * Opt-in sonarjs duplication subset + unused-imports / unused private members.
19
+ * `true` enables defaults; an object toggles subgroups; omit / `false` leaves off.
20
+ */
21
+ codeQuality?: boolean | CodeQualityOptions;
22
+ /**
23
+ * Opt-in consistent-type-* and explicit-* typing rules.
24
+ * `true` enables defaults; an object toggles individual rules; omit / `false` leaves off.
25
+ */
26
+ explicitTypes?: boolean | ExplicitTypesOptions;
15
27
  }
16
28
  /**
17
29
  * Core TypeScript lint rules (no type-aware block).
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMrC,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAyC,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5F,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,2EAA2E;IAC3E,WAAW,CAAC,EAAE,KAAK,GAAG,mBAAmB,CAAC;IAC1C,yEAAyE;IACzE,WAAW,CAAC,EAAE,KAAK,GAAG,kBAAkB,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC,WAAW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HANGED
@@ -4,6 +4,8 @@ import importX from 'eslint-plugin-import-x';
4
4
  import prettierPlugin from 'eslint-plugin-prettier';
5
5
  import globals from 'globals';
6
6
  import tseslint from 'typescript-eslint';
7
+ import { codeQualityPlugins, codeQualityRules, } from './code-quality.js';
8
+ import { explicitTypesRules, } from './explicit-types.js';
7
9
  import { createImportOrderRules, } from './import-order.js';
8
10
  import { defaultPrettierOptions, prettierRules } from './prettier.js';
9
11
  /**
@@ -25,6 +27,18 @@ export function baseRules(options) {
25
27
  }
26
28
  return {
27
29
  ...js.configs.recommended.rules,
30
+ // Restore typescript-eslint's eslint-recommended compatibility overrides.
31
+ // js.configs.recommended re-enables rules TypeScript already covers
32
+ // (no-undef, no-redeclare, no-dupe-class-members, ...).
33
+ ...tseslint.configs.eslintRecommended.rules,
34
+ // Deliberate deviations from eslint-recommended:
35
+ // tsc only surfaces unreachable code as an editor suggestion unless
36
+ // allowUnreachableCode: false is set, so keep the lint rule.
37
+ 'no-unreachable': 'error',
38
+ '@typescript-eslint/no-unused-expressions': [
39
+ 'error',
40
+ { allowShortCircuit: true, allowTernary: true, allowTaggedTemplates: true },
41
+ ],
28
42
  'no-unused-vars': 'off',
29
43
  ...createImportOrderRules({
30
44
  importOrder: options?.importOrder,
@@ -45,6 +59,8 @@ export function baseRules(options) {
45
59
  },
46
60
  ],
47
61
  'kj/no-pure-type-alias': 'error',
62
+ ...codeQualityRules(options?.codeQuality),
63
+ ...explicitTypesRules(options?.explicitTypes),
48
64
  ...prettierRuleBlock,
49
65
  };
50
66
  }
@@ -71,6 +87,7 @@ export function createBaseConfig(options) {
71
87
  'import-x': importX,
72
88
  prettier: prettierPlugin,
73
89
  kj: kjPlugin,
90
+ ...codeQualityPlugins(options?.codeQuality),
74
91
  },
75
92
  rules: baseRules(options),
76
93
  };
package/dist/base.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,M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,iBAAiB,EAAE,IAAI;gBACvB,YAAY,EAAE,KAAK;gBACnB,yBAAyB,EAAE,IAAI;gBAC/B,8BAA8B,EAAE,IAAI;gBACpC,iBAAiB,EAAE,IAAI;gBACvB,kBAAkB,EAAE,IAAI;aACzB;SACF;QACD,uBAAuB,EAAE,OAAO;QAChC,GAAG,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC;QACzC,GAAG,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC;QAC7C,GAAG,iBAAiB;KACrB,CAAC;AACJ,CAAC;AAMD,gFAAgF;AAChF,MAAM,UAAU,gBAAgB,CAAC,OAA2B;IAC1D,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC,eAAe,CAAC,CAAC;IAElD,OAAO;QACL,KAAK;QACL,eAAe,EAAE;YACf,WAAW,EAAE,QAAQ;YACrB,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE;gBACP,GAAG,OAAO,CAAC,IAAI;gBACf,GAAG,OAAO,CAAC,MAAM;aAClB;YACD,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,aAAa,EAAE;gBACb,WAAW,EAAE,QAAQ;gBACrB,UAAU,EAAE,QAAQ;aACrB;SACF;QACD,OAAO,EAAE;YACP,oBAAoB,EAAE,QAAQ,CAAC,MAAM;YACrC,UAAU,EAAE,OAAO;YACnB,QAAQ,EAAE,cAAc;YACxB,EAAE,EAAE,QAAQ;YACZ,GAAG,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC;SAC5C;QACD,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC;KAC1B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ESLint, Linter } from 'eslint';
2
+ export interface CodeQualityOptions {
3
+ /** sonarjs in-file duplication subset. Cross-file clones are jscpd's job. */
4
+ duplication?: boolean;
5
+ /** unused-imports/no-unused-imports + @typescript-eslint/no-unused-private-class-members. */
6
+ unusedSymbols?: boolean;
7
+ }
8
+ export declare const defaultCodeQualityOptions: Required<CodeQualityOptions>;
9
+ /** Plugin registrations for the codeQuality group; empty when fully disabled. */
10
+ export declare function codeQualityPlugins(setting?: boolean | CodeQualityOptions): Record<string, ESLint.Plugin>;
11
+ export declare function codeQualityRules(setting?: boolean | CodeQualityOptions): Linter.RulesRecord;
12
+ /**
13
+ * Standalone flat-config block for the codeQuality group. Use when composing
14
+ * without `createTypescriptConfig` (for example a React Native preset).
15
+ */
16
+ export declare function createCodeQualityConfig(setting?: boolean | CodeQualityOptions): Linter.Config;
17
+ //# sourceMappingURL=code-quality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-quality.d.ts","sourceRoot":"","sources":["../src/code-quality.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAI7C,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,kBAAkB,CAGlE,CAAC;AAiBF,iFAAiF;AACjF,wBAAgB,kBAAkB,CAChC,OAAO,CAAC,EAAE,OAAO,GAAG,kBAAkB,GACrC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAc/B;AAED,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,kBAAkB,GAAG,MAAM,CAAC,WAAW,CAsB3F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,OAAO,GAAG,kBAAyB,GAAG,MAAM,CAAC,MAAM,CAMnG"}
@@ -0,0 +1,64 @@
1
+ import sonarjs from 'eslint-plugin-sonarjs';
2
+ import unusedImports from 'eslint-plugin-unused-imports';
3
+ export const defaultCodeQualityOptions = {
4
+ duplication: true,
5
+ unusedSymbols: true,
6
+ };
7
+ function resolveOptions(setting) {
8
+ if (setting === undefined || setting === false) {
9
+ return null;
10
+ }
11
+ if (setting === true) {
12
+ return { ...defaultCodeQualityOptions };
13
+ }
14
+ return {
15
+ ...defaultCodeQualityOptions,
16
+ ...setting,
17
+ };
18
+ }
19
+ /** Plugin registrations for the codeQuality group; empty when fully disabled. */
20
+ export function codeQualityPlugins(setting) {
21
+ const options = resolveOptions(setting);
22
+ if (!options) {
23
+ return {};
24
+ }
25
+ const plugins = {};
26
+ if (options.duplication) {
27
+ plugins.sonarjs = sonarjs;
28
+ }
29
+ if (options.unusedSymbols) {
30
+ plugins['unused-imports'] = unusedImports;
31
+ }
32
+ return plugins;
33
+ }
34
+ export function codeQualityRules(setting) {
35
+ const options = resolveOptions(setting);
36
+ if (!options) {
37
+ return {};
38
+ }
39
+ const rules = {};
40
+ if (options.duplication) {
41
+ rules['sonarjs/no-identical-functions'] = 'error';
42
+ rules['sonarjs/no-duplicated-branches'] = 'error';
43
+ rules['sonarjs/no-all-duplicated-branches'] = 'error';
44
+ rules['sonarjs/no-identical-conditions'] = 'error';
45
+ rules['sonarjs/no-identical-expressions'] = 'error';
46
+ }
47
+ if (options.unusedSymbols) {
48
+ rules['unused-imports/no-unused-imports'] = 'error';
49
+ rules['@typescript-eslint/no-unused-private-class-members'] = 'error';
50
+ }
51
+ return rules;
52
+ }
53
+ /**
54
+ * Standalone flat-config block for the codeQuality group. Use when composing
55
+ * without `createTypescriptConfig` (for example a React Native preset).
56
+ */
57
+ export function createCodeQualityConfig(setting = true) {
58
+ return {
59
+ files: ['**/*.{ts,tsx}'],
60
+ plugins: codeQualityPlugins(setting),
61
+ rules: codeQualityRules(setting),
62
+ };
63
+ }
64
+ //# sourceMappingURL=code-quality.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-quality.js","sourceRoot":"","sources":["../src/code-quality.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,aAAa,MAAM,8BAA8B,C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oC,CAAC,GAAG,OAAO,CAAC;QACtD,KAAK,CAAC,iCAAiC,CAAC,GAAG,OAAO,CAAC;QACnD,KAAK,CAAC,kCAAkC,CAAC,GAAG,OAAO,CAAC;IACtD,CAAC;IAED,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAC1B,KAAK,CAAC,kCAAkC,CAAC,GAAG,OAAO,CAAC;QACpD,KAAK,CAAC,oDAAoD,CAAC,GAAG,OAAO,CAAC;IACxE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAAwC,IAAI;IAClF,OAAO;QACL,KAAK,EAAE,CAAC,eAAe,CAAC;QACxB,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAC;QACpC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC;KACjC,CAAC;AACJ,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import type { Linter } from 'eslint';
2
+ import type { CodeQualityOptions } from './code-quality.js';
3
+ import type { ExplicitTypesOptions } from './explicit-types.js';
2
4
  import type { ImportXOrderOptions, SortImportsOptions } from './import-order.js';
3
5
  import type { PrettierSetting } from './prettier.js';
4
6
  export interface CreateTypescriptConfigOptions {
@@ -22,6 +24,15 @@ export interface CreateTypescriptConfigOptions {
22
24
  importOrder?: false | ImportXOrderOptions;
23
25
  /** `sort-imports` options (shallow merge). `false` disables the rule. */
24
26
  sortImports?: false | SortImportsOptions;
27
+ /**
28
+ * Opt-in sonarjs duplication subset + unused-imports / unused private members.
29
+ * Default off.
30
+ */
31
+ codeQuality?: boolean | CodeQualityOptions;
32
+ /**
33
+ * Opt-in consistent-type-* and explicit-* typing rules. Default off.
34
+ */
35
+ explicitTypes?: boolean | ExplicitTypesOptions;
25
36
  }
26
37
  /**
27
38
  * Flat ESLint config factory for TypeScript projects.
@@ -1 +1 @@
1
- {"version":3,"file":"create-typescript-config.d.ts","sourceRoot":"","sources":["../src/create-typescript-config.ts"],"names":[],"mapp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AE,eAAe,CAAC;IAC3B,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,KAAK,GAAG,mBAAmB,CAAC;IAC1C,yEAAyE;IACzE,WAAW,CAAC,EAAE,KAAK,GAAG,kBAAkB,CAAC;IACzC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC3C;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,oBAAoB,CAAC;CAChD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,6BAAkC,GAAG,MAAM,CAAC,MAAM,EAAE,CA0BnG"}
@@ -23,6 +23,8 @@ export function createTypescriptConfig(options = {}) {
23
23
  prettier: options.prettier,
24
24
  importOrder: options.importOrder,
25
25
  sortImports: options.sortImports,
26
+ codeQuality: options.codeQuality,
27
+ explicitTypes: options.explicitTypes,
26
28
  }),
27
29
  ];
28
30
  if (options.tsconfigRootDir) {
@@ -1 +1 @@
1
- {"version":3,"file":"create-typescript-config.js","sourceRoot":"","sources":["../src/create-typescript-config.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,wBAAwB,CAAC;AAEpD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AAGzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAyBnD;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAyC,EAAE;IAChF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,eAAe,CAAC,CAAC;IACjD,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IAE7C,MAAM,OAAO,GAAoB;QAC/B;YACE,OAAO,EAAE,CAAC,GA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gBAAgB,CAAC;YACf,KAAK;YACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC;KACH,CAAC;IAEF,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAE7B,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { Linter } from 'eslint';
2
+ export interface ExplicitTypesOptions {
3
+ /** Prefer `: T = {…}` over `{…} as T` on object/array literals. */
4
+ typeAssertions?: boolean;
5
+ /** Prefer `import type` with inline fix style. */
6
+ typeImports?: boolean;
7
+ /** Exported functions and public methods declare parameter and return types. */
8
+ moduleBoundaryTypes?: boolean;
9
+ /** Internal functions declare return types. Noisy in `.tsx`; pass `false` there. */
10
+ functionReturnType?: boolean;
11
+ }
12
+ export declare const defaultExplicitTypesOptions: Required<ExplicitTypesOptions>;
13
+ /** Shared option objects for the explicitTypes group. */
14
+ export declare const consistentTypeAssertionsOptions: {
15
+ assertionStyle: "as";
16
+ objectLiteralTypeAssertions: "never";
17
+ arrayLiteralTypeAssertions: "never";
18
+ };
19
+ export declare const consistentTypeImportsOptions: {
20
+ prefer: "type-imports";
21
+ fixStyle: "inline-type-imports";
22
+ disallowTypeAnnotations: boolean;
23
+ };
24
+ export declare const explicitFunctionReturnTypeOptions: {
25
+ allowExpressions: boolean;
26
+ allowTypedFunctionExpressions: boolean;
27
+ allowHigherOrderFunctions: boolean;
28
+ };
29
+ export declare function explicitTypesRules(setting?: boolean | ExplicitTypesOptions): Linter.RulesRecord;
30
+ /**
31
+ * Standalone flat-config block for the explicitTypes group. Use when composing
32
+ * without `createTypescriptConfig` (for example a React Native preset).
33
+ */
34
+ export declare function createExplicitTypesConfig(setting?: boolean | ExplicitTypesOptions): Linter.Config;
35
+ //# sourceMappingURL=explicit-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explicit-types.d.ts","sourceRoot":"","sources":["../src/explicit-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kDAAkD;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gFAAgF;IAChF,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oFAAoF;IACpF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,oBAAoB,CAKtE,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,+BAA+B;;;;CAI3C,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;CAIxC,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;CAI7C,CAAC;AAiBF,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GAAG,MAAM,CAAC,WAAW,CA+B/F;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,OAAO,GAAG,oBAA2B,GAC7C,MAAM,CAAC,MAAM,CAKf"}
@@ -0,0 +1,71 @@
1
+ export const defaultExplicitTypesOptions = {
2
+ typeAssertions: true,
3
+ typeImports: true,
4
+ moduleBoundaryTypes: true,
5
+ functionReturnType: true,
6
+ };
7
+ /** Shared option objects for the explicitTypes group. */
8
+ export const consistentTypeAssertionsOptions = {
9
+ assertionStyle: 'as',
10
+ objectLiteralTypeAssertions: 'never',
11
+ arrayLiteralTypeAssertions: 'never',
12
+ };
13
+ export const consistentTypeImportsOptions = {
14
+ prefer: 'type-imports',
15
+ fixStyle: 'inline-type-imports',
16
+ disallowTypeAnnotations: true,
17
+ };
18
+ export const explicitFunctionReturnTypeOptions = {
19
+ allowExpressions: true,
20
+ allowTypedFunctionExpressions: true,
21
+ allowHigherOrderFunctions: true,
22
+ };
23
+ function resolveOptions(setting) {
24
+ if (setting === undefined || setting === false) {
25
+ return null;
26
+ }
27
+ if (setting === true) {
28
+ return { ...defaultExplicitTypesOptions };
29
+ }
30
+ return {
31
+ ...defaultExplicitTypesOptions,
32
+ ...setting,
33
+ };
34
+ }
35
+ export function explicitTypesRules(setting) {
36
+ const options = resolveOptions(setting);
37
+ if (!options) {
38
+ return {};
39
+ }
40
+ const rules = {};
41
+ if (options.typeAssertions) {
42
+ rules['@typescript-eslint/consistent-type-assertions'] = [
43
+ 'error',
44
+ consistentTypeAssertionsOptions,
45
+ ];
46
+ }
47
+ if (options.typeImports) {
48
+ rules['@typescript-eslint/consistent-type-imports'] = ['error', consistentTypeImportsOptions];
49
+ }
50
+ if (options.moduleBoundaryTypes) {
51
+ rules['@typescript-eslint/explicit-module-boundary-types'] = 'error';
52
+ }
53
+ if (options.functionReturnType) {
54
+ rules['@typescript-eslint/explicit-function-return-type'] = [
55
+ 'error',
56
+ explicitFunctionReturnTypeOptions,
57
+ ];
58
+ }
59
+ return rules;
60
+ }
61
+ /**
62
+ * Standalone flat-config block for the explicitTypes group. Use when composing
63
+ * without `createTypescriptConfig` (for example a React Native preset).
64
+ */
65
+ export function createExplicitTypesConfig(setting = true) {
66
+ return {
67
+ files: ['**/*.{ts,tsx}'],
68
+ rules: explicitTypesRules(setting),
69
+ };
70
+ }
71
+ //# sourceMappingURL=explicit-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explicit-types.js","sourceRoot":"","sources":["../src/explicit-types.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,2BAA2B,GAAmC;IACzE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AAG,CAAC,OAAO,EAAE,4BAA4B,CAAC,CAAC;IAChG,CAAC;IAED,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAChC,KAAK,CAAC,mDAAmD,CAAC,GAAG,OAAO,CAAC;IACvE,CAAC;IAED,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAC/B,KAAK,CAAC,kDAAkD,CAAC,GAAG;YAC1D,OAAO;YACP,iCAAiC;SAClC,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAA0C,IAAI;IAE9C,OAAO;QACL,KAAK,EAAE,CAAC,eAAe,CAAC;QACxB,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC;KACnC,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { baseRules, createBaseConfig, type BaseConfigOptions, type BaseRulesOptions } from './base.js';
2
+ export { codeQualityPlugins, codeQualityRules, createCodeQualityConfig, defaultCodeQualityOptions, type CodeQualityOptions, } from './code-quality.js';
2
3
  export { createTypescriptConfig, type CreateTypescriptConfigOptions, } from './create-typescript-config.js';
4
+ export { consistentTypeAssertionsOptions, consistentTypeImportsOptions, createExplicitTypesConfig, defaultExplicitTypesOptions, explicitFunctionReturnTypeOptions, explicitTypesRules, type ExplicitTypesOptions, } from './explicit-types.js';
3
5
  export { ignores } from './ignores.js';
4
6
  export { createImportOrderRules, defaultImportXOrderOptions, defaultSortImportsOptions, importOrderRules, type CreateImportOrderRulesOptions, type ImportXOrderOptions, type SortImportsOptions, } from './import-order.js';
5
7
  export { defaultPrettierOptions, prettierRules, type PrettierSetting } from './prettier.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,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M,eAAe,CAAC;AAC5F,OAAO,EACL,qBAAqB,EACrB,KAAK,4BAA4B,GAClC,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  export { baseRules, createBaseConfig } from './base.js';
2
+ export { codeQualityPlugins, codeQualityRules, createCodeQualityConfig, defaultCodeQualityOptions, } from './code-quality.js';
2
3
  export { createTypescriptConfig, } from './create-typescript-config.js';
4
+ export { consistentTypeAssertionsOptions, consistentTypeImportsOptions, createExplicitTypesConfig, defaultExplicitTypesOptions, explicitFunctionReturnTypeOptions, explicitTypesRules, } from './explicit-types.js';
3
5
  export { ignores } from './ignores.js';
4
6
  export { createImportOrderRules, defaultImportXOrderOptions, defaultSortImportsOptions, importOrderRules, } from './import-order.js';
5
7
  export { defaultPrettierOptions, prettierRules } from './prettier.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAiD,MAAM,WAAW,CAAC;AACvG,OAAO,EACL,sBAAsB,GAEvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,gBAAgB,GAIjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAwB,MAAM,eAAe,CAAC;AAC5F,OAAO,EACL,qBAAqB,GAEtB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAiD,MAAM,WAAW,CAAC;AACvG,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,GAE1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,sBAAsB,GAEvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,iCAAiC,EACjC,kBAAkB,GAEnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,gBAAgB,GAIjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAwB,MAAM,eAAe,CAAC;AAC5F,OAAO,EACL,qBAAqB,GAEtB,MAAM,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kristijorgji/eslint-config-typescript",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Flat ESLint TypeScript config factory built on @kristijorgji/eslint-plugin",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -51,6 +51,8 @@
51
51
  "eslint-config-prettier": "^10",
52
52
  "eslint-plugin-import-x": "^4",
53
53
  "eslint-plugin-prettier": "^5",
54
+ "eslint-plugin-sonarjs": "^4",
55
+ "eslint-plugin-unused-imports": "^4",
54
56
  "globals": "^17",
55
57
  "typescript-eslint": "^8",
56
58
  "@kristijorgji/eslint-plugin": "^0.2.0"