@kristijorgji/eslint-config-typescript 1.0.0 → 1.1.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 +11 -4
- package/dist/base.d.ts +13 -4
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +17 -5
- package/dist/base.js.map +1 -1
- package/dist/create-typescript-config.d.ts +11 -4
- package/dist/create-typescript-config.d.ts.map +1 -1
- package/dist/create-typescript-config.js +2 -0
- package/dist/create-typescript-config.js.map +1 -1
- 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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -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 +7 -7
package/README.md
CHANGED
|
@@ -17,6 +17,8 @@ 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',
|
|
20
22
|
});
|
|
21
23
|
```
|
|
22
24
|
|
|
@@ -26,8 +28,10 @@ export default createTypescriptConfig({
|
|
|
26
28
|
| --- | --- |
|
|
27
29
|
| `files` | Glob patterns (default `**/*.{ts,tsx}`) |
|
|
28
30
|
| `tsconfigRootDir` | Enables type-aware rules via `createTypedLintConfig` |
|
|
29
|
-
| `prettier` | `true` (default), `
|
|
31
|
+
| `prettier` | `true` (default, embeds package defaults), `'prettierrc'` (defer to the consumer's Prettier config file), a Prettier options object (replaces defaults), or `false` |
|
|
30
32
|
| `ignores` | Extra ignore globs |
|
|
33
|
+
| `importOrder` | Options for `import-x/order`, shallow-merged over package defaults; `false` disables the rule |
|
|
34
|
+
| `sortImports` | Options for `sort-imports`, shallow-merged over package defaults; `false` disables the rule |
|
|
31
35
|
|
|
32
36
|
### Named exports / subpaths
|
|
33
37
|
|
|
@@ -36,10 +40,13 @@ export default createTypescriptConfig({
|
|
|
36
40
|
- `./typed` — `createTypedLintConfig`
|
|
37
41
|
- `./ignores` — default ignore block
|
|
38
42
|
|
|
43
|
+
Also exported: `createImportOrderRules`, `importOrderRules`,
|
|
44
|
+
`defaultImportXOrderOptions`, `defaultSortImportsOptions`.
|
|
45
|
+
|
|
39
46
|
### Plugin rule placement
|
|
40
47
|
|
|
41
|
-
This package enables **`kj/no-pure-type-alias` only**. JSX
|
|
42
|
-
single-export barrels, and component extraction
|
|
43
|
-
`@kristijorgji/eslint-config-react-typescript`.
|
|
48
|
+
This package enables **`kj/no-pure-type-alias` only**. JSX prop order
|
|
49
|
+
(`perfectionist/sort-jsx-props`), single-export barrels, and component extraction
|
|
50
|
+
live in `@kristijorgji/eslint-config-react-typescript`.
|
|
44
51
|
|
|
45
52
|
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,22 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
-
import {
|
|
2
|
+
import { type ImportXOrderOptions, type SortImportsOptions } from './import-order.js';
|
|
3
|
+
import { type PrettierSetting } from './prettier.js';
|
|
3
4
|
export interface BaseRulesOptions {
|
|
4
|
-
/**
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Prettier integration. `true` (default) uses package defaults; `'prettierrc'`
|
|
7
|
+
* defers to the consumer's Prettier config file; pass an options object to
|
|
8
|
+
* replace defaults; `false` disables `prettier/prettier`.
|
|
9
|
+
*/
|
|
10
|
+
prettier?: PrettierSetting;
|
|
11
|
+
/** `import-x/order` options (shallow merge). `false` disables the rule. */
|
|
12
|
+
importOrder?: false | ImportXOrderOptions;
|
|
13
|
+
/** `sort-imports` options (shallow merge). `false` disables the rule. */
|
|
14
|
+
sortImports?: false | SortImportsOptions;
|
|
6
15
|
}
|
|
7
16
|
/**
|
|
8
17
|
* Core TypeScript lint rules (no type-aware block).
|
|
9
18
|
* Includes `kj/no-pure-type-alias` only — single-export barrels and JSX prop order
|
|
10
|
-
* belong on the React factory
|
|
19
|
+
* belong on the React factory.
|
|
11
20
|
*/
|
|
12
21
|
export declare function baseRules(options?: BaseRulesOptions): Linter.RulesRecord;
|
|
13
22
|
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,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,CAmCxE;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,CA0B3E"}
|
package/dist/base.js
CHANGED
|
@@ -4,20 +4,32 @@ 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 { createImportOrderRules, } from './import-order.js';
|
|
8
8
|
import { defaultPrettierOptions, prettierRules } from './prettier.js';
|
|
9
9
|
/**
|
|
10
10
|
* Core TypeScript lint rules (no type-aware block).
|
|
11
11
|
* Includes `kj/no-pure-type-alias` only — single-export barrels and JSX prop order
|
|
12
|
-
* belong on the React factory
|
|
12
|
+
* belong on the React factory.
|
|
13
13
|
*/
|
|
14
14
|
export function baseRules(options) {
|
|
15
15
|
const prettier = options?.prettier ?? true;
|
|
16
|
-
|
|
16
|
+
let prettierRuleBlock = {};
|
|
17
|
+
if (prettier === 'prettierrc') {
|
|
18
|
+
prettierRuleBlock = prettierRules('prettierrc');
|
|
19
|
+
}
|
|
20
|
+
else if (prettier === true) {
|
|
21
|
+
prettierRuleBlock = prettierRules(defaultPrettierOptions);
|
|
22
|
+
}
|
|
23
|
+
else if (prettier !== false) {
|
|
24
|
+
prettierRuleBlock = prettierRules(prettier);
|
|
25
|
+
}
|
|
17
26
|
return {
|
|
18
27
|
...js.configs.recommended.rules,
|
|
19
28
|
'no-unused-vars': 'off',
|
|
20
|
-
...
|
|
29
|
+
...createImportOrderRules({
|
|
30
|
+
importOrder: options?.importOrder,
|
|
31
|
+
sortImports: options?.sortImports,
|
|
32
|
+
}),
|
|
21
33
|
'import-x/no-unresolved': 'off',
|
|
22
34
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
23
35
|
'@typescript-eslint/no-unused-vars': [
|
|
@@ -33,7 +45,7 @@ export function baseRules(options) {
|
|
|
33
45
|
},
|
|
34
46
|
],
|
|
35
47
|
'kj/no-pure-type-alias': 'error',
|
|
36
|
-
...
|
|
48
|
+
...prettierRuleBlock,
|
|
37
49
|
};
|
|
38
50
|
}
|
|
39
51
|
/** Flat config block for TypeScript sources (parser + plugins + base rules). */
|
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":"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,EACL,sBAAsB,GAGvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAwB,MAAM,eAAe,CAAC;AAe5F;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAA0B;IAClD,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,IAAI,CAAC;IAC3C,IAAI,iBAAiB,GAAuB,EAAE,CAAC;I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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;SACb;QACD,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ImportXOrderOptions, SortImportsOptions } from './import-order.js';
|
|
3
|
+
import type { PrettierSetting } from './prettier.js';
|
|
3
4
|
export interface CreateTypescriptConfigOptions {
|
|
4
5
|
/** Glob patterns for TypeScript files. Defaults to all `.ts` / `.tsx` files. */
|
|
5
6
|
files?: string[];
|
|
@@ -9,12 +10,18 @@ export interface CreateTypescriptConfigOptions {
|
|
|
9
10
|
*/
|
|
10
11
|
tsconfigRootDir?: string;
|
|
11
12
|
/**
|
|
12
|
-
* Prettier integration. `true` (default) uses package defaults;
|
|
13
|
-
*
|
|
13
|
+
* Prettier integration. `true` (default) uses package defaults; `'prettierrc'`
|
|
14
|
+
* defers to the consumer's Prettier config file; pass an options object to
|
|
15
|
+
* replace defaults; `false` disables `prettier/prettier` (still applies
|
|
16
|
+
* eslint-config-prettier last).
|
|
14
17
|
*/
|
|
15
|
-
prettier?:
|
|
18
|
+
prettier?: PrettierSetting;
|
|
16
19
|
/** Extra ignore patterns merged into the default ignores block. */
|
|
17
20
|
ignores?: string[];
|
|
21
|
+
/** `import-x/order` options (shallow merge). `false` disables the rule. */
|
|
22
|
+
importOrder?: false | ImportXOrderOptions;
|
|
23
|
+
/** `sort-imports` options (shallow merge). `false` disables the rule. */
|
|
24
|
+
sortImports?: false | SortImportsOptions;
|
|
18
25
|
}
|
|
19
26
|
/**
|
|
20
27
|
* 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;AAKrC,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;CAC1C;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,6BAAkC,GAAG,MAAM,CAAC,MAAM,EAAE,CAwBnG"}
|
|
@@ -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;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,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;SACjC,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"}
|
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,UA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igOptions, type BaseRulesOptions } from './base.js';
|
|
2
2
|
export { createTypescriptConfig, type CreateTypescriptConfigOptions, } from './create-typescript-config.js';
|
|
3
3
|
export { ignores } from './ignores.js';
|
|
4
|
-
export { importOrderRules } from './import-order.js';
|
|
5
|
-
export { defaultPrettierOptions, prettierRules } from './prettier.js';
|
|
4
|
+
export { createImportOrderRules, defaultImportXOrderOptions, defaultSortImportsOptions, importOrderRules, type CreateImportOrderRulesOptions, type ImportXOrderOptions, type SortImportsOptions, } from './import-order.js';
|
|
5
|
+
export { defaultPrettierOptions, prettierRules, type PrettierSetting } from './prettier.js';
|
|
6
6
|
export { createTypedLintConfig, type CreateTypedLintConfigOptions, } from './typed.js';
|
|
7
7
|
//# 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,sBAAsB,EACtB,KAAK,6BAA6B,GACnC,MAAM,+BAA+B,CAAC;AACvC,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,7 @@
|
|
|
1
1
|
export { baseRules, createBaseConfig } from './base.js';
|
|
2
2
|
export { createTypescriptConfig, } from './create-typescript-config.js';
|
|
3
3
|
export { ignores } from './ignores.js';
|
|
4
|
-
export { importOrderRules } from './import-order.js';
|
|
4
|
+
export { createImportOrderRules, defaultImportXOrderOptions, defaultSortImportsOptions, importOrderRules, } from './import-order.js';
|
|
5
5
|
export { defaultPrettierOptions, prettierRules } from './prettier.js';
|
|
6
6
|
export { createTypedLintConfig, } from './typed.js';
|
|
7
7
|
//# 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,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"}
|
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.1.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,16 @@
|
|
|
51
51
|
"eslint-config-prettier": "^10",
|
|
52
52
|
"eslint-plugin-import-x": "^4",
|
|
53
53
|
"eslint-plugin-prettier": "^5",
|
|
54
|
-
"globals": "^
|
|
54
|
+
"globals": "^17",
|
|
55
55
|
"typescript-eslint": "^8",
|
|
56
|
-
"@kristijorgji/eslint-plugin": "^0.
|
|
56
|
+
"@kristijorgji/eslint-plugin": "^0.2.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
"eslint": "^
|
|
59
|
+
"@types/node": "^26",
|
|
60
|
+
"eslint": "^10",
|
|
61
61
|
"prettier": "^3",
|
|
62
62
|
"typescript": "^5",
|
|
63
|
-
"vitest": "^
|
|
63
|
+
"vitest": "^4"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "tsc -p tsconfig.json",
|