@kristijorgji/eslint-config-typescript 1.0.0 → 1.2.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 +50 -4
- package/dist/base.d.ts +25 -4
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +34 -5
- package/dist/base.js.map +1 -1
- package/dist/code-quality.d.ts +17 -0
- package/dist/code-quality.d.ts.map +1 -0
- package/dist/code-quality.js +64 -0
- package/dist/code-quality.js.map +1 -0
- package/dist/create-typescript-config.d.ts +22 -4
- package/dist/create-typescript-config.d.ts.map +1 -1
- package/dist/create-typescript-config.js +4 -0
- package/dist/create-typescript-config.js.map +1 -1
- package/dist/explicit-types.d.ts +35 -0
- package/dist/explicit-types.d.ts.map +1 -0
- package/dist/explicit-types.js +71 -0
- package/dist/explicit-types.js.map +1 -0
- package/dist/import-order.d.ts +43 -0
- package/dist/import-order.d.ts.map +1 -1
- package/dist/import-order.js +46 -20
- package/dist/import-order.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/prettier.d.ts +10 -1
- package/dist/prettier.d.ts.map +1 -1
- package/dist/prettier.js +5 -0
- package/dist/prettier.js.map +1 -1
- package/dist/typed.d.ts +1 -1
- package/dist/typed.js +1 -1
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -17,6 +17,11 @@ import { createTypescriptConfig } from '@kristijorgji/eslint-config-typescript';
|
|
|
17
17
|
|
|
18
18
|
export default createTypescriptConfig({
|
|
19
19
|
tsconfigRootDir: import.meta.dirname,
|
|
20
|
+
// Prefer your repo's .prettierrc as the single source of truth:
|
|
21
|
+
prettier: 'prettierrc',
|
|
22
|
+
// Opt into shared consumer policies (default off):
|
|
23
|
+
codeQuality: true,
|
|
24
|
+
explicitTypes: true,
|
|
20
25
|
});
|
|
21
26
|
```
|
|
22
27
|
|
|
@@ -26,8 +31,37 @@ export default createTypescriptConfig({
|
|
|
26
31
|
| --- | --- |
|
|
27
32
|
| `files` | Glob patterns (default `**/*.{ts,tsx}`) |
|
|
28
33
|
| `tsconfigRootDir` | Enables type-aware rules via `createTypedLintConfig` |
|
|
29
|
-
| `prettier` | `true` (default), `
|
|
34
|
+
| `prettier` | `true` (default, embeds package defaults), `'prettierrc'` (defer to the consumer's Prettier config file), a Prettier options object (replaces defaults), or `false` |
|
|
30
35
|
| `ignores` | Extra ignore globs |
|
|
36
|
+
| `importOrder` | Options for `import-x/order`, shallow-merged over package defaults; `false` disables the rule |
|
|
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` with the option objects shared by existing consumers. Default off. Pass `functionReturnType: false` when you disable return types on `.tsx` via a local override. |
|
|
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
|
+
// local .tsx override:
|
|
59
|
+
{
|
|
60
|
+
files: ['**/*.{tsx,jsx}'],
|
|
61
|
+
rules: { '@typescript-eslint/explicit-function-return-type': 'off' },
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
```
|
|
31
65
|
|
|
32
66
|
### Named exports / subpaths
|
|
33
67
|
|
|
@@ -36,10 +70,22 @@ export default createTypescriptConfig({
|
|
|
36
70
|
- `./typed` — `createTypedLintConfig`
|
|
37
71
|
- `./ignores` — default ignore block
|
|
38
72
|
|
|
73
|
+
Also exported: `createImportOrderRules`, `importOrderRules`,
|
|
74
|
+
`defaultImportXOrderOptions`, `defaultSortImportsOptions`,
|
|
75
|
+
`createCodeQualityConfig`, `createExplicitTypesConfig`.
|
|
76
|
+
|
|
39
77
|
### Plugin rule placement
|
|
40
78
|
|
|
41
|
-
This package enables **`kj/no-pure-type-alias` only
|
|
42
|
-
|
|
43
|
-
|
|
79
|
+
This package enables **`kj/no-pure-type-alias` only** from the plugin set
|
|
80
|
+
(plus optional `codeQuality` / `explicitTypes` groups above). JSX prop order
|
|
81
|
+
(`perfectionist/sort-jsx-props`), single-export barrels, and component extraction
|
|
82
|
+
live in `@kristijorgji/eslint-config-react-typescript`.
|
|
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.
|
|
44
90
|
|
|
45
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,13 +1,34 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
-
import {
|
|
2
|
+
import { type CodeQualityOptions } from './code-quality.js';
|
|
3
|
+
import { type ExplicitTypesOptions } from './explicit-types.js';
|
|
4
|
+
import { type ImportXOrderOptions, type SortImportsOptions } from './import-order.js';
|
|
5
|
+
import { type PrettierSetting } from './prettier.js';
|
|
3
6
|
export interface BaseRulesOptions {
|
|
4
|
-
/**
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Prettier integration. `true` (default) uses package defaults; `'prettierrc'`
|
|
9
|
+
* defers to the consumer's Prettier config file; pass an options object to
|
|
10
|
+
* replace defaults; `false` disables `prettier/prettier`.
|
|
11
|
+
*/
|
|
12
|
+
prettier?: PrettierSetting;
|
|
13
|
+
/** `import-x/order` options (shallow merge). `false` disables the rule. */
|
|
14
|
+
importOrder?: false | ImportXOrderOptions;
|
|
15
|
+
/** `sort-imports` options (shallow merge). `false` disables the rule. */
|
|
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 shared by consumers.
|
|
24
|
+
* `true` enables defaults; an object toggles individual rules; omit / `false` leaves off.
|
|
25
|
+
*/
|
|
26
|
+
explicitTypes?: boolean | ExplicitTypesOptions;
|
|
6
27
|
}
|
|
7
28
|
/**
|
|
8
29
|
* Core TypeScript lint rules (no type-aware block).
|
|
9
30
|
* Includes `kj/no-pure-type-alias` only — single-export barrels and JSX prop order
|
|
10
|
-
* belong on the React factory
|
|
31
|
+
* belong on the React factory.
|
|
11
32
|
*/
|
|
12
33
|
export declare function baseRules(options?: BaseRulesOptions): Linter.RulesRecord;
|
|
13
34
|
export interface BaseConfigOptions extends BaseRulesOptions {
|
package/dist/base.d.ts.map
CHANGED
|
@@ -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;
|
|
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,EAGL,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,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;IACzC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC;IAC3C;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,oBAAoB,CAAC;CAChD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC,WAAW,CAiDxE;AAED,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,CA2B3E"}
|
package/dist/base.js
CHANGED
|
@@ -4,20 +4,46 @@ 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 {
|
|
7
|
+
import { codeQualityPlugins, codeQualityRules, } from './code-quality.js';
|
|
8
|
+
import { explicitTypesRules, } from './explicit-types.js';
|
|
9
|
+
import { createImportOrderRules, } from './import-order.js';
|
|
8
10
|
import { defaultPrettierOptions, prettierRules } from './prettier.js';
|
|
9
11
|
/**
|
|
10
12
|
* Core TypeScript lint rules (no type-aware block).
|
|
11
13
|
* Includes `kj/no-pure-type-alias` only — single-export barrels and JSX prop order
|
|
12
|
-
* belong on the React factory
|
|
14
|
+
* belong on the React factory.
|
|
13
15
|
*/
|
|
14
16
|
export function baseRules(options) {
|
|
15
17
|
const prettier = options?.prettier ?? true;
|
|
16
|
-
|
|
18
|
+
let prettierRuleBlock = {};
|
|
19
|
+
if (prettier === 'prettierrc') {
|
|
20
|
+
prettierRuleBlock = prettierRules('prettierrc');
|
|
21
|
+
}
|
|
22
|
+
else if (prettier === true) {
|
|
23
|
+
prettierRuleBlock = prettierRules(defaultPrettierOptions);
|
|
24
|
+
}
|
|
25
|
+
else if (prettier !== false) {
|
|
26
|
+
prettierRuleBlock = prettierRules(prettier);
|
|
27
|
+
}
|
|
17
28
|
return {
|
|
18
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, matching both consumers:
|
|
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
|
+
],
|
|
19
42
|
'no-unused-vars': 'off',
|
|
20
|
-
...
|
|
43
|
+
...createImportOrderRules({
|
|
44
|
+
importOrder: options?.importOrder,
|
|
45
|
+
sortImports: options?.sortImports,
|
|
46
|
+
}),
|
|
21
47
|
'import-x/no-unresolved': 'off',
|
|
22
48
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
23
49
|
'@typescript-eslint/no-unused-vars': [
|
|
@@ -33,7 +59,9 @@ export function baseRules(options) {
|
|
|
33
59
|
},
|
|
34
60
|
],
|
|
35
61
|
'kj/no-pure-type-alias': 'error',
|
|
36
|
-
...(
|
|
62
|
+
...codeQualityRules(options?.codeQuality),
|
|
63
|
+
...explicitTypesRules(options?.explicitTypes),
|
|
64
|
+
...prettierRuleBlock,
|
|
37
65
|
};
|
|
38
66
|
}
|
|
39
67
|
/** Flat config block for TypeScript sources (parser + plugins + base rules). */
|
|
@@ -59,6 +87,7 @@ export function createBaseConfig(options) {
|
|
|
59
87
|
'import-x': importX,
|
|
60
88
|
prettier: prettierPlugin,
|
|
61
89
|
kj: kjPlugin,
|
|
90
|
+
...codeQualityPlugins(options?.codeQuality),
|
|
62
91
|
},
|
|
63
92
|
rules: baseRules(options),
|
|
64
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,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAEzC,OAAO,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AA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E,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,CAAC;AASzD,MAAM,CAAC,MAAM,yBAAyB,GAAiC;IACrE,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,SAAS,cAAc,CACrB,OAAsC;IAEtC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC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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,5 +1,8 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CodeQualityOptions } from './code-quality.js';
|
|
3
|
+
import type { ExplicitTypesOptions } from './explicit-types.js';
|
|
4
|
+
import type { ImportXOrderOptions, SortImportsOptions } from './import-order.js';
|
|
5
|
+
import type { PrettierSetting } from './prettier.js';
|
|
3
6
|
export interface CreateTypescriptConfigOptions {
|
|
4
7
|
/** Glob patterns for TypeScript files. Defaults to all `.ts` / `.tsx` files. */
|
|
5
8
|
files?: string[];
|
|
@@ -9,12 +12,27 @@ export interface CreateTypescriptConfigOptions {
|
|
|
9
12
|
*/
|
|
10
13
|
tsconfigRootDir?: string;
|
|
11
14
|
/**
|
|
12
|
-
* Prettier integration. `true` (default) uses package defaults;
|
|
13
|
-
*
|
|
15
|
+
* Prettier integration. `true` (default) uses package defaults; `'prettierrc'`
|
|
16
|
+
* defers to the consumer's Prettier config file; pass an options object to
|
|
17
|
+
* replace defaults; `false` disables `prettier/prettier` (still applies
|
|
18
|
+
* eslint-config-prettier last).
|
|
14
19
|
*/
|
|
15
|
-
prettier?:
|
|
20
|
+
prettier?: PrettierSetting;
|
|
16
21
|
/** Extra ignore patterns merged into the default ignores block. */
|
|
17
22
|
ignores?: string[];
|
|
23
|
+
/** `import-x/order` options (shallow merge). `false` disables the rule. */
|
|
24
|
+
importOrder?: false | ImportXOrderOptions;
|
|
25
|
+
/** `sort-imports` options (shallow merge). `false` disables the rule. */
|
|
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;
|
|
18
36
|
}
|
|
19
37
|
/**
|
|
20
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":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"create-typescript-config.d.ts","sourceRoot":"","sources":["../src/create-typescript-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,WAAW,6BAA6B;IAC5C,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,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"}
|
|
@@ -21,6 +21,10 @@ export function createTypescriptConfig(options = {}) {
|
|
|
21
21
|
createBaseConfig({
|
|
22
22
|
files,
|
|
23
23
|
prettier: options.prettier,
|
|
24
|
+
importOrder: options.importOrder,
|
|
25
|
+
sortImports: options.sortImports,
|
|
26
|
+
codeQuality: options.codeQuality,
|
|
27
|
+
explicitTypes: options.explicitTypes,
|
|
24
28
|
}),
|
|
25
29
|
];
|
|
26
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;
|
|
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;AAG7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AAGzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAkCnD;;;;;;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,GAAG,CAAC,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,GAAG,cAAc,CAAC;SAChE;QACD,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW;QAC/B,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
|
+
/** Option objects shared by both consumers (sb + prona). */
|
|
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,4DAA4D;AAC5D,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
|
+
/** Option objects shared by both consumers (sb + prona). */
|
|
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,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,IAAI;IACjB,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,cAAc,EAAE,IAAa;IA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kB,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/import-order.d.ts
CHANGED
|
@@ -1,7 +1,50 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
+
export interface ImportXOrderOptions {
|
|
3
|
+
groups?: (string | string[])[];
|
|
4
|
+
pathGroups?: {
|
|
5
|
+
pattern: string;
|
|
6
|
+
group: string;
|
|
7
|
+
position?: 'before' | 'after';
|
|
8
|
+
}[];
|
|
9
|
+
pathGroupsExcludedImportTypes?: string[];
|
|
10
|
+
'newlines-between'?: 'always' | 'always-and-inside-groups' | 'never' | 'ignore';
|
|
11
|
+
alphabetize?: {
|
|
12
|
+
order: 'asc' | 'desc' | 'ignore';
|
|
13
|
+
caseInsensitive?: boolean;
|
|
14
|
+
};
|
|
15
|
+
distinctGroup?: boolean;
|
|
16
|
+
warnOnUnassignedImports?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface SortImportsOptions {
|
|
19
|
+
ignoreCase?: boolean;
|
|
20
|
+
ignoreDeclarationSort?: boolean;
|
|
21
|
+
ignoreMemberSort?: boolean;
|
|
22
|
+
allowSeparatedGroups?: boolean;
|
|
23
|
+
memberSyntaxSortOrder?: string[];
|
|
24
|
+
}
|
|
25
|
+
export declare const defaultImportXOrderOptions: ImportXOrderOptions;
|
|
26
|
+
export declare const defaultSortImportsOptions: SortImportsOptions;
|
|
2
27
|
/**
|
|
3
28
|
* Import ordering rules using `eslint-plugin-import-x`.
|
|
4
29
|
* Exported so consumers can compose without taking the full factory.
|
|
30
|
+
* Prefer {@link createImportOrderRules} when you need overrides.
|
|
5
31
|
*/
|
|
6
32
|
export declare const importOrderRules: Linter.RulesRecord;
|
|
33
|
+
export interface CreateImportOrderRulesOptions {
|
|
34
|
+
/**
|
|
35
|
+
* `import-x/order` options, shallow-merged over the defaults (arrays replace).
|
|
36
|
+
* `false` disables the rule.
|
|
37
|
+
*/
|
|
38
|
+
importOrder?: false | ImportXOrderOptions;
|
|
39
|
+
/**
|
|
40
|
+
* `sort-imports` options, shallow-merged over the defaults (arrays replace).
|
|
41
|
+
* `false` disables the rule.
|
|
42
|
+
*/
|
|
43
|
+
sortImports?: false | SortImportsOptions;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Builds import-order related rules. Called with no arguments, the result is
|
|
47
|
+
* deep-equal to {@link importOrderRules}.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createImportOrderRules(options?: CreateImportOrderRulesOptions): Linter.RulesRecord;
|
|
7
50
|
//# sourceMappingURL=import-order.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-order.d.ts","sourceRoot":"","sources":["../src/import-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC
|
|
1
|
+
{"version":3,"file":"import-order.d.ts","sourceRoot":"","sources":["../src/import-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;KAAE,EAAE,CAAC;IACjF,6BAA6B,CAAC,EAAE,MAAM,EAAE,CAAC;IACzC,kBAAkB,CAAC,EAAE,QAAQ,GAAG,0BAA0B,GAAG,OAAO,GAAG,QAAQ,CAAC;IAChF,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC9E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAED,eAAO,MAAM,0BAA0B,EAAE,mBAOxC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,kBAKvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,WAKrC,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,mBAAmB,CAAC;IAC1C;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,kBAAkB,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,CAAC,EAAE,6BAA6B,GACtC,MAAM,CAAC,WAAW,CA2BpB"}
|
package/dist/import-order.js
CHANGED
|
@@ -1,29 +1,55 @@
|
|
|
1
|
+
export const defaultImportXOrderOptions = {
|
|
2
|
+
groups: ['builtin', 'external', 'internal', ['parent', 'sibling']],
|
|
3
|
+
'newlines-between': 'always',
|
|
4
|
+
alphabetize: {
|
|
5
|
+
order: 'asc',
|
|
6
|
+
caseInsensitive: true,
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
export const defaultSortImportsOptions = {
|
|
10
|
+
ignoreCase: true,
|
|
11
|
+
ignoreDeclarationSort: true,
|
|
12
|
+
ignoreMemberSort: false,
|
|
13
|
+
allowSeparatedGroups: true,
|
|
14
|
+
};
|
|
1
15
|
/**
|
|
2
16
|
* Import ordering rules using `eslint-plugin-import-x`.
|
|
3
17
|
* Exported so consumers can compose without taking the full factory.
|
|
18
|
+
* Prefer {@link createImportOrderRules} when you need overrides.
|
|
4
19
|
*/
|
|
5
20
|
export const importOrderRules = {
|
|
6
21
|
'import-x/first': 'error',
|
|
7
22
|
'import-x/no-duplicates': 'error',
|
|
8
|
-
'import-x/order': [
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
groups: ['builtin', 'external', 'internal', ['parent', 'sibling']],
|
|
12
|
-
'newlines-between': 'always',
|
|
13
|
-
alphabetize: {
|
|
14
|
-
order: 'asc',
|
|
15
|
-
caseInsensitive: true,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
'sort-imports': [
|
|
20
|
-
'error',
|
|
21
|
-
{
|
|
22
|
-
ignoreCase: true,
|
|
23
|
-
ignoreDeclarationSort: true,
|
|
24
|
-
ignoreMemberSort: false,
|
|
25
|
-
allowSeparatedGroups: true,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
23
|
+
'import-x/order': ['error', defaultImportXOrderOptions],
|
|
24
|
+
'sort-imports': ['error', defaultSortImportsOptions],
|
|
28
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Builds import-order related rules. Called with no arguments, the result is
|
|
28
|
+
* deep-equal to {@link importOrderRules}.
|
|
29
|
+
*/
|
|
30
|
+
export function createImportOrderRules(options) {
|
|
31
|
+
const rules = {
|
|
32
|
+
'import-x/first': 'error',
|
|
33
|
+
'import-x/no-duplicates': 'error',
|
|
34
|
+
};
|
|
35
|
+
if (options?.importOrder !== false) {
|
|
36
|
+
rules['import-x/order'] = [
|
|
37
|
+
'error',
|
|
38
|
+
{
|
|
39
|
+
...defaultImportXOrderOptions,
|
|
40
|
+
...(options?.importOrder ?? {}),
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
if (options?.sortImports !== false) {
|
|
45
|
+
rules['sort-imports'] = [
|
|
46
|
+
'error',
|
|
47
|
+
{
|
|
48
|
+
...defaultSortImportsOptions,
|
|
49
|
+
...(options?.sortImports ?? {}),
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
return rules;
|
|
54
|
+
}
|
|
29
55
|
//# sourceMappingURL=import-order.js.map
|
package/dist/import-order.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-order.js","sourceRoot":"","sources":["../src/import-order.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import-order.js","sourceRoot":"","sources":["../src/import-order.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,0BAA0B,GAAwB;IAC7D,MAAM,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAClE,kBAAkB,EAAE,QAAQ;IAC5B,WAAW,EAAE;QACX,KAAK,EAAE,KAAK;QACZ,eAAe,EAAE,IAAI;KACtB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAuB;IAC3D,UAAU,EAAE,IAAI;IAChB,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE,KAAK;IACvB,oBAAoB,EAAE,IAAI;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAuB;IAClD,gBAAgB,EAAE,OAAO;IACzB,wBAAwB,EAAE,OAAO;IACjC,gBAAgB,EAAE,CAAC,OAAO,EAAE,0BAA0B,CAAC;IACvD,cAAc,EAAE,CAAC,OAAO,EAAE,yBAAyB,CAAC;CACrD,CAAC;AAeF;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAuC;IAEvC,MAAM,KAAK,GAAuB;QAChC,gBAAgB,EAAE,OAAO;QACzB,wBAAwB,EAAE,OAAO;KAClC,CAAC;IAEF,IAAI,OAAO,EAAE,WAAW,KAAK,KAAK,EAAE,CAAC;QACnC,KAAK,CAAC,gBAAgB,CAAC,GAAG;YACxB,OAAO;YACP;gBACE,GAAG,0BAA0B;gBAC7B,GAAG,CAAC,OAAO,EAAE,WAAW,IAAI,EAAE,CAAC;aAChC;SACF,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,EAAE,WAAW,KAAK,KAAK,EAAE,CAAC;QACnC,KAAK,CAAC,cAAc,CAAC,GAAG;YACtB,OAAO;YACP;gBACE,GAAG,yBAAyB;gBAC5B,GAAG,CAAC,OAAO,EAAE,WAAW,IAAI,EAAE,CAAC;aAChC;SACF,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
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
|
-
export { importOrderRules } from './import-order.js';
|
|
5
|
-
export { defaultPrettierOptions, prettierRules } from './prettier.js';
|
|
6
|
+
export { createImportOrderRules, defaultImportXOrderOptions, defaultSortImportsOptions, importOrderRules, type CreateImportOrderRulesOptions, type ImportXOrderOptions, type SortImportsOptions, } from './import-order.js';
|
|
7
|
+
export { defaultPrettierOptions, prettierRules, type PrettierSetting } from './prettier.js';
|
|
6
8
|
export { createTypedLintConfig, type CreateTypedLintConfigOptions, } from './typed.js';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,MAAM,WAAW,CAAC;AACvG,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,GACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,
|
|
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,MAAM,WAAW,CAAC;AACvG,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,sBAAsB,EACtB,KAAK,6BAA6B,GACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,iCAAiC,EACjC,kBAAkB,EAClB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,gBAAgB,EAChB,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,EACL,qBAAqB,EACrB,KAAK,4BAA4B,GAClC,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
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
|
-
export { importOrderRules } from './import-order.js';
|
|
6
|
+
export { createImportOrderRules, defaultImportXOrderOptions, defaultSortImportsOptions, importOrderRules, } from './import-order.js';
|
|
5
7
|
export { defaultPrettierOptions, prettierRules } from './prettier.js';
|
|
6
8
|
export { createTypedLintConfig, } from './typed.js';
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
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,
|
|
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/dist/prettier.d.ts
CHANGED
|
@@ -2,9 +2,18 @@ import type { Linter } from 'eslint';
|
|
|
2
2
|
import type { Options as PrettierOptions } from 'prettier';
|
|
3
3
|
/** Default Prettier options embedded in `prettier/prettier` (legacy config parity). */
|
|
4
4
|
export declare const defaultPrettierOptions: PrettierOptions;
|
|
5
|
+
/**
|
|
6
|
+
* Prettier integration setting.
|
|
7
|
+
* - `true` (default): embed {@link defaultPrettierOptions}
|
|
8
|
+
* - `'prettierrc'`: emit bare `'prettier/prettier': 'error'` so the consumer's
|
|
9
|
+
* `.prettierrc` / `.prettierrc.js` is the single source of truth
|
|
10
|
+
* - object: replace the defaults entirely (not deep-merged)
|
|
11
|
+
* - `false`: omit the rule
|
|
12
|
+
*/
|
|
13
|
+
export type PrettierSetting = boolean | 'prettierrc' | PrettierOptions;
|
|
5
14
|
/**
|
|
6
15
|
* Builds the `prettier/prettier` rule entry.
|
|
7
16
|
* Pass `false` to `createTypescriptConfig({ prettier: false })` to skip.
|
|
8
17
|
*/
|
|
9
|
-
export declare function prettierRules(options?: PrettierOptions): Linter.RulesRecord;
|
|
18
|
+
export declare function prettierRules(options?: PrettierOptions | 'prettierrc'): Linter.RulesRecord;
|
|
10
19
|
//# sourceMappingURL=prettier.d.ts.map
|
package/dist/prettier.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../src/prettier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,EAAE,eAUpC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../src/prettier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,EAAE,eAUpC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,YAAY,GAAG,eAAe,CAAC;AAEvE;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,GAAE,eAAe,GAAG,YAAqC,GAC/D,MAAM,CAAC,WAAW,CAUpB"}
|
package/dist/prettier.js
CHANGED
|
@@ -15,6 +15,11 @@ export const defaultPrettierOptions = {
|
|
|
15
15
|
* Pass `false` to `createTypescriptConfig({ prettier: false })` to skip.
|
|
16
16
|
*/
|
|
17
17
|
export function prettierRules(options = defaultPrettierOptions) {
|
|
18
|
+
if (options === 'prettierrc') {
|
|
19
|
+
return {
|
|
20
|
+
'prettier/prettier': 'error',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
18
23
|
return {
|
|
19
24
|
'prettier/prettier': ['error', options],
|
|
20
25
|
};
|
package/dist/prettier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.js","sourceRoot":"","sources":["../src/prettier.ts"],"names":[],"mappings":"AAGA,uFAAuF;AACvF,MAAM,CAAC,MAAM,sBAAsB,GAAoB;IACrD,WAAW,EAAE,OAAO;IACpB,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,GAAG;IACf,IAAI,EAAE,IAAI;IACV,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;CAChB,CAAC;
|
|
1
|
+
{"version":3,"file":"prettier.js","sourceRoot":"","sources":["../src/prettier.ts"],"names":[],"mappings":"AAGA,uFAAuF;AACvF,MAAM,CAAC,MAAM,sBAAsB,GAAoB;IACrD,WAAW,EAAE,OAAO;IACpB,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,GAAG;IACf,IAAI,EAAE,IAAI;IACV,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;CAChB,CAAC;AAYF;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,UAA0C,sBAAsB;IAEhE,IAAI,OAAO,KAAK,YAAY,EAAE,CAAC;QAC7B,OAAO;YACL,mBAAmB,EAAE,OAAO;SAC7B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,mBAAmB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;KACxC,CAAC;AACJ,CAAC"}
|
package/dist/typed.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface CreateTypedLintConfigOptions {
|
|
|
5
5
|
severity?: 'error' | 'warn';
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Type-aware ESLint block
|
|
8
|
+
* Type-aware ESLint block.
|
|
9
9
|
* Enables `kj/no-weak-typeof-satisfies` plus `@typescript-eslint/no-unnecessary-type-assertion`.
|
|
10
10
|
*/
|
|
11
11
|
export declare function createTypedLintConfig(options: CreateTypedLintConfigOptions): Linter.Config;
|
package/dist/typed.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { typed } from '@kristijorgji/eslint-plugin';
|
|
2
2
|
/**
|
|
3
|
-
* Type-aware ESLint block
|
|
3
|
+
* Type-aware ESLint block.
|
|
4
4
|
* Enables `kj/no-weak-typeof-satisfies` plus `@typescript-eslint/no-unnecessary-type-assertion`.
|
|
5
5
|
*/
|
|
6
6
|
export function createTypedLintConfig(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kristijorgji/eslint-config-typescript",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Flat ESLint TypeScript config factory built on @kristijorgji/eslint-plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public",
|
|
13
|
-
"provenance":
|
|
13
|
+
"provenance": true
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
@@ -51,16 +51,18 @@
|
|
|
51
51
|
"eslint-config-prettier": "^10",
|
|
52
52
|
"eslint-plugin-import-x": "^4",
|
|
53
53
|
"eslint-plugin-prettier": "^5",
|
|
54
|
-
"
|
|
54
|
+
"eslint-plugin-sonarjs": "^4",
|
|
55
|
+
"eslint-plugin-unused-imports": "^4",
|
|
56
|
+
"globals": "^17",
|
|
55
57
|
"typescript-eslint": "^8",
|
|
56
|
-
"@kristijorgji/eslint-plugin": "^0.
|
|
58
|
+
"@kristijorgji/eslint-plugin": "^0.2.0"
|
|
57
59
|
},
|
|
58
60
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
"eslint": "^
|
|
61
|
+
"@types/node": "^26",
|
|
62
|
+
"eslint": "^10",
|
|
61
63
|
"prettier": "^3",
|
|
62
64
|
"typescript": "^5",
|
|
63
|
-
"vitest": "^
|
|
65
|
+
"vitest": "^4"
|
|
64
66
|
},
|
|
65
67
|
"scripts": {
|
|
66
68
|
"build": "tsc -p tsconfig.json",
|