@kristijorgji/eslint-config-typescript 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Kristi Jorgji
3
+ Copyright (c) 2026 kristijorgji
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,34 +1,45 @@
1
1
  # @kristijorgji/eslint-config-typescript
2
2
 
3
- Eslint and prettier rules for general purpose typescript projects.
4
- If you want rules specific for React/NextJS or other frameworks have to enrich these rules after including.
3
+ Flat ESLint config factory for TypeScript projects, built on
4
+ [`@kristijorgji/eslint-plugin`](https://www.npmjs.com/package/@kristijorgji/eslint-plugin).
5
5
 
6
+ ## Install
6
7
 
7
- ## Usage
8
- ### Install deps
9
- Install the correct versions of each package, which are listed by the command:
10
- ```shell
11
- yarn add --dev @kristijorgji/eslint-config-typescript@latest
8
+ ```bash
9
+ pnpm add -D @kristijorgji/eslint-config-typescript eslint typescript prettier
12
10
  ```
13
11
 
14
- If you are migrating old service to new plugin first please make sure to first remove old dependencies that are duplicates like example `yarn remove eslint prettier @typescript-eslint/eslint-plugin etc`
12
+ ## Usage
15
13
 
16
- ### Config
17
- Add the following to your `.eslintrc.js`:
18
14
  ```js
19
- module.exports = {
20
- extends: ['@kristijorgji/eslint-config-typescript'],
21
- };
15
+ // eslint.config.js
16
+ import { createTypescriptConfig } from '@kristijorgji/eslint-config-typescript';
22
17
 
18
+ export default createTypescriptConfig({
19
+ tsconfigRootDir: import.meta.dirname,
20
+ });
23
21
  ```
24
22
 
25
- ## Develop
26
- More info on how to develop your custom eslint config can be found here: https://eslint.org/docs/developer-guide/shareable-configs
23
+ ### Options
24
+
25
+ | Option | Description |
26
+ | --- | --- |
27
+ | `files` | Glob patterns (default `**/*.{ts,tsx}`) |
28
+ | `tsconfigRootDir` | Enables type-aware rules via `createTypedLintConfig` |
29
+ | `prettier` | `true` (default), `false`, or Prettier options object |
30
+ | `ignores` | Extra ignore globs |
31
+
32
+ ### Named exports / subpaths
33
+
34
+ - `@kristijorgji/eslint-config-typescript` — factory + all named parts
35
+ - `./base` — `createBaseConfig` / `baseRules`
36
+ - `./typed` — `createTypedLintConfig`
37
+ - `./ignores` — default ignore block
38
+
39
+ ### Plugin rule placement
27
40
 
28
- To develop locally you can install with `yarn add --dev pathtolocalfile` example
29
- `yarn add --dev /Users/kristi.jorgji/Desktop/fl-lite/eslint-config-typescript`
30
-
31
- You need to run the above command after every plugin change.
32
- ## License
41
+ This package enables **`kj/no-pure-type-alias` only**. JSX leading-prop order,
42
+ single-export barrels, and component extraction live in
43
+ `@kristijorgji/eslint-config-react-typescript`.
33
44
 
34
- [MIT](LICENSE)
45
+ 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 ADDED
@@ -0,0 +1,18 @@
1
+ import type { Linter } from 'eslint';
2
+ import { defaultPrettierOptions } from './prettier.js';
3
+ export interface BaseRulesOptions {
4
+ /** Whether to enable `prettier/prettier`. Defaults to true. */
5
+ prettier?: boolean | typeof defaultPrettierOptions;
6
+ }
7
+ /**
8
+ * Core TypeScript lint rules (no type-aware block).
9
+ * Includes `kj/no-pure-type-alias` only — single-export barrels and JSX prop order
10
+ * belong on the React factory (prona/sb split placement).
11
+ */
12
+ export declare function baseRules(options?: BaseRulesOptions): Linter.RulesRecord;
13
+ export interface BaseConfigOptions extends BaseRulesOptions {
14
+ files?: string[];
15
+ }
16
+ /** Flat config block for TypeScript sources (parser + plugins + base rules). */
17
+ export declare function createBaseConfig(options?: BaseConfigOptions): Linter.Config;
18
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOrC,OAAO,EAAE,sBAAsB,EAAiB,MAAM,eAAe,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,sBAAsB,CAAC;CACpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC,WAAW,CA0BxE;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 ADDED
@@ -0,0 +1,66 @@
1
+ import js from '@eslint/js';
2
+ import { plugin as kjPlugin } from '@kristijorgji/eslint-plugin';
3
+ import importX from 'eslint-plugin-import-x';
4
+ import prettierPlugin from 'eslint-plugin-prettier';
5
+ import globals from 'globals';
6
+ import tseslint from 'typescript-eslint';
7
+ import { importOrderRules } from './import-order.js';
8
+ import { defaultPrettierOptions, prettierRules } from './prettier.js';
9
+ /**
10
+ * Core TypeScript lint rules (no type-aware block).
11
+ * Includes `kj/no-pure-type-alias` only — single-export barrels and JSX prop order
12
+ * belong on the React factory (prona/sb split placement).
13
+ */
14
+ export function baseRules(options) {
15
+ const prettier = options?.prettier ?? true;
16
+ const prettierOpts = prettier === false ? null : prettier === true ? defaultPrettierOptions : prettier;
17
+ return {
18
+ ...js.configs.recommended.rules,
19
+ 'no-unused-vars': 'off',
20
+ ...importOrderRules,
21
+ 'import-x/no-unresolved': 'off',
22
+ '@typescript-eslint/no-explicit-any': 'error',
23
+ '@typescript-eslint/no-unused-vars': [
24
+ 'error',
25
+ {
26
+ args: 'all',
27
+ argsIgnorePattern: '^_',
28
+ caughtErrors: 'all',
29
+ caughtErrorsIgnorePattern: '^_',
30
+ destructuredArrayIgnorePattern: '^_',
31
+ varsIgnorePattern: '^_',
32
+ ignoreRestSiblings: true,
33
+ },
34
+ ],
35
+ 'kj/no-pure-type-alias': 'error',
36
+ ...(prettierOpts ? prettierRules(prettierOpts) : {}),
37
+ };
38
+ }
39
+ /** Flat config block for TypeScript sources (parser + plugins + base rules). */
40
+ export function createBaseConfig(options) {
41
+ const files = options?.files ?? ['**/*.{ts,tsx}'];
42
+ return {
43
+ files,
44
+ languageOptions: {
45
+ ecmaVersion: 'latest',
46
+ sourceType: 'module',
47
+ globals: {
48
+ ...globals.node,
49
+ ...globals.es2021,
50
+ },
51
+ parser: tseslint.parser,
52
+ parserOptions: {
53
+ ecmaVersion: 'latest',
54
+ sourceType: 'module',
55
+ },
56
+ },
57
+ plugins: {
58
+ '@typescript-eslint': tseslint.plugin,
59
+ 'import-x': importX,
60
+ prettier: prettierPlugin,
61
+ kj: kjPlugin,
62
+ },
63
+ rules: baseRules(options),
64
+ };
65
+ }
66
+ //# sourceMappingURL=base.js.map
@@ -0,0 +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,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAOtE;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAA0B;IAClD,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,IAAI,CAAC;IAC3C,MAAM,YAAY,GAChB,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEpF,OAAO;QACL,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;QAC/B,gBAAgB,EAAE,KAAK;QACvB,GAAG,gBAAgB;QACnB,wBAAwB,EAAE,KAAK;QAC/B,oCAAoC,EAAE,OAAO;QAC7C,mCAAmC,EAAE;YACnC,OAAO;YACP;gBACE,IAAI,EAAE,KAAK;gBACX,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,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACrD,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;SACb;QACD,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC;KAC1B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { Options as PrettierOptions } from 'prettier';
3
+ export interface CreateTypescriptConfigOptions {
4
+ /** Glob patterns for TypeScript files. Defaults to all `.ts` / `.tsx` files. */
5
+ files?: string[];
6
+ /**
7
+ * When set, appends the type-aware block (`createTypedLintConfig`).
8
+ * Required for `kj/no-weak-typeof-satisfies`.
9
+ */
10
+ tsconfigRootDir?: string;
11
+ /**
12
+ * Prettier integration. `true` (default) uses package defaults; pass an options
13
+ * object to override; `false` disables `prettier/prettier` (still applies prettierConfig last).
14
+ */
15
+ prettier?: boolean | PrettierOptions;
16
+ /** Extra ignore patterns merged into the default ignores block. */
17
+ ignores?: string[];
18
+ }
19
+ /**
20
+ * Flat ESLint config factory for TypeScript projects.
21
+ *
22
+ * Enables `kj/no-pure-type-alias` only from the plugin recommended set.
23
+ * Use `@kristijorgji/eslint-config-react-typescript` for JSX prop order,
24
+ * single-export barrels, and component-extraction rules.
25
+ */
26
+ export declare function createTypescriptConfig(options?: CreateTypescriptConfigOptions): Linter.Config[];
27
+ //# sourceMappingURL=create-typescript-config.d.ts.map
@@ -0,0 +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;AACrC,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAO3D,MAAM,WAAW,6BAA6B;IAC5C,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IACrC,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,6BAAkC,GAAG,MAAM,CAAC,MAAM,EAAE,CAsBnG"}
@@ -0,0 +1,32 @@
1
+ import prettierConfig from 'eslint-config-prettier';
2
+ import tseslint from 'typescript-eslint';
3
+ import { createBaseConfig } from './base.js';
4
+ import { ignores as defaultIgnores } from './ignores.js';
5
+ import { createTypedLintConfig } from './typed.js';
6
+ /**
7
+ * Flat ESLint config factory for TypeScript projects.
8
+ *
9
+ * Enables `kj/no-pure-type-alias` only from the plugin recommended set.
10
+ * Use `@kristijorgji/eslint-config-react-typescript` for JSX prop order,
11
+ * single-export barrels, and component-extraction rules.
12
+ */
13
+ export function createTypescriptConfig(options = {}) {
14
+ const files = options.files ?? ['**/*.{ts,tsx}'];
15
+ const ignorePatterns = options.ignores ?? [];
16
+ const configs = [
17
+ {
18
+ ignores: [...(defaultIgnores.ignores ?? []), ...ignorePatterns],
19
+ },
20
+ ...tseslint.configs.recommended,
21
+ createBaseConfig({
22
+ files,
23
+ prettier: options.prettier,
24
+ }),
25
+ ];
26
+ if (options.tsconfigRootDir) {
27
+ configs.push(createTypedLintConfig({ tsconfigRootDir: options.tsconfigRootDir }));
28
+ }
29
+ configs.push(prettierConfig);
30
+ return configs;
31
+ }
32
+ //# sourceMappingURL=create-typescript-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-typescript-config.js","sourceRoot":"","sources":["../src/create-typescript-config.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,wBAAwB,CAAC;AAGpD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAmBnD;;;;;;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;SAC3B,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,4 @@
1
+ import type { Linter } from 'eslint';
2
+ /** Default ignore patterns for TypeScript projects. */
3
+ export declare const ignores: Linter.Config;
4
+ //# sourceMappingURL=ignores.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignores.d.ts","sourceRoot":"","sources":["../src/ignores.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,uDAAuD;AACvD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAS5B,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** Default ignore patterns for TypeScript projects. */
2
+ export const ignores = {
3
+ ignores: [
4
+ '**/node_modules/**',
5
+ '**/dist/**',
6
+ '**/build/**',
7
+ '**/coverage/**',
8
+ '**/.next/**',
9
+ '**/storybook-static/**',
10
+ ],
11
+ };
12
+ //# sourceMappingURL=ignores.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignores.js","sourceRoot":"","sources":["../src/ignores.ts"],"names":[],"mappings":"AAEA,uDAAuD;AACvD,MAAM,CAAC,MAAM,OAAO,GAAkB;IACpC,OAAO,EAAE;QACP,oBAAoB;QACpB,YAAY;QACZ,aAAa;QACb,gBAAgB;QAChB,aAAa;QACb,wBAAwB;KACzB;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Linter } from 'eslint';
2
+ /**
3
+ * Import ordering rules using `eslint-plugin-import-x`.
4
+ * Exported so consumers can compose without taking the full factory.
5
+ */
6
+ export declare const importOrderRules: Linter.RulesRecord;
7
+ //# sourceMappingURL=import-order.d.ts.map
@@ -0,0 +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;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,WAuBrC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Import ordering rules using `eslint-plugin-import-x`.
3
+ * Exported so consumers can compose without taking the full factory.
4
+ */
5
+ export const importOrderRules = {
6
+ 'import-x/first': 'error',
7
+ 'import-x/no-duplicates': 'error',
8
+ 'import-x/order': [
9
+ 'error',
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
+ ],
28
+ };
29
+ //# sourceMappingURL=import-order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-order.js","sourceRoot":"","sources":["../src/import-order.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAuB;IAClD,gBAAgB,EAAE,OAAO;IACzB,wBAAwB,EAAE,OAAO;IACjC,gBAAgB,EAAE;QAChB,OAAO;QACP;YACE,MAAM,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;YAClE,kBAAkB,EAAE,QAAQ;YAC5B,WAAW,EAAE;gBACX,KAAK,EAAE,KAAK;gBACZ,eAAe,EAAE,IAAI;aACtB;SACF;KACF;IACD,cAAc,EAAE;QACd,OAAO;QACP;YACE,UAAU,EAAE,IAAI;YAChB,qBAAqB,EAAE,IAAI;YAC3B,gBAAgB,EAAE,KAAK;YACvB,oBAAoB,EAAE,IAAI;SAC3B;KACF;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { baseRules, createBaseConfig, type BaseConfigOptions, type BaseRulesOptions } from './base.js';
2
+ export { createTypescriptConfig, type CreateTypescriptConfigOptions, } from './create-typescript-config.js';
3
+ export { ignores } from './ignores.js';
4
+ export { importOrderRules } from './import-order.js';
5
+ export { defaultPrettierOptions, prettierRules } from './prettier.js';
6
+ export { createTypedLintConfig, type CreateTypedLintConfigOptions, } from './typed.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,qBAAqB,EACrB,KAAK,4BAA4B,GAClC,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { baseRules, createBaseConfig } from './base.js';
2
+ export { createTypescriptConfig, } from './create-typescript-config.js';
3
+ export { ignores } from './ignores.js';
4
+ export { importOrderRules } from './import-order.js';
5
+ export { defaultPrettierOptions, prettierRules } from './prettier.js';
6
+ export { createTypedLintConfig, } from './typed.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,qBAAqB,GAEtB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { Options as PrettierOptions } from 'prettier';
3
+ /** Default Prettier options embedded in `prettier/prettier` (legacy config parity). */
4
+ export declare const defaultPrettierOptions: PrettierOptions;
5
+ /**
6
+ * Builds the `prettier/prettier` rule entry.
7
+ * Pass `false` to `createTypescriptConfig({ prettier: false })` to skip.
8
+ */
9
+ export declare function prettierRules(options?: PrettierOptions): Linter.RulesRecord;
10
+ //# sourceMappingURL=prettier.d.ts.map
@@ -0,0 +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,CAAC,OAAO,GAAE,eAAwC,GAAG,MAAM,CAAC,WAAW,CAInG"}
@@ -0,0 +1,22 @@
1
+ /** Default Prettier options embedded in `prettier/prettier` (legacy config parity). */
2
+ export const defaultPrettierOptions = {
3
+ arrowParens: 'avoid',
4
+ bracketSpacing: true,
5
+ printWidth: 120,
6
+ semi: true,
7
+ singleQuote: true,
8
+ tabWidth: 4,
9
+ trailingComma: 'all',
10
+ useTabs: false,
11
+ endOfLine: 'lf',
12
+ };
13
+ /**
14
+ * Builds the `prettier/prettier` rule entry.
15
+ * Pass `false` to `createTypescriptConfig({ prettier: false })` to skip.
16
+ */
17
+ export function prettierRules(options = defaultPrettierOptions) {
18
+ return {
19
+ 'prettier/prettier': ['error', options],
20
+ };
21
+ }
22
+ //# sourceMappingURL=prettier.js.map
@@ -0,0 +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;AAEF;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,UAA2B,sBAAsB;IAC7E,OAAO;QACL,mBAAmB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;KACxC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Linter } from 'eslint';
2
+ export interface CreateTypedLintConfigOptions {
3
+ /** Directory containing the consumer's `tsconfig.json`. */
4
+ tsconfigRootDir: string;
5
+ severity?: 'error' | 'warn';
6
+ }
7
+ /**
8
+ * Type-aware ESLint block (ported from prona365 `createTypedLintConfig`).
9
+ * Enables `kj/no-weak-typeof-satisfies` plus `@typescript-eslint/no-unnecessary-type-assertion`.
10
+ */
11
+ export declare function createTypedLintConfig(options: CreateTypedLintConfigOptions): Linter.Config;
12
+ //# sourceMappingURL=typed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../src/typed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,WAAW,4BAA4B;IAC3C,2DAA2D;IAC3D,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM,CAAC,MAAM,CAiB1F"}
package/dist/typed.js ADDED
@@ -0,0 +1,22 @@
1
+ import { typed } from '@kristijorgji/eslint-plugin';
2
+ /**
3
+ * Type-aware ESLint block (ported from prona365 `createTypedLintConfig`).
4
+ * Enables `kj/no-weak-typeof-satisfies` plus `@typescript-eslint/no-unnecessary-type-assertion`.
5
+ */
6
+ export function createTypedLintConfig(options) {
7
+ const [weakTypeofConfig] = typed({
8
+ tsconfigRootDir: options.tsconfigRootDir,
9
+ severity: options.severity,
10
+ });
11
+ if (!weakTypeofConfig) {
12
+ throw new Error('typed() returned no config blocks');
13
+ }
14
+ return {
15
+ ...weakTypeofConfig,
16
+ rules: {
17
+ '@typescript-eslint/no-unnecessary-type-assertion': 'error',
18
+ ...weakTypeofConfig.rules,
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=typed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed.js","sourceRoot":"","sources":["../src/typed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AASpD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAqC;IACzE,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;QAC/B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAC,CAAC;IAEH,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAED,OAAO;QACL,GAAG,gBAAgB;QACnB,KAAK,EAAE;YACL,kDAAkD,EAAE,OAAO;YAC3D,GAAG,gBAAgB,CAAC,KAAK;SAC1B;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,28 +1,71 @@
1
1
  {
2
2
  "name": "@kristijorgji/eslint-config-typescript",
3
- "version": "0.0.1",
4
- "description": "eslint config for typescript based projects",
3
+ "version": "1.0.0",
4
+ "description": "Flat ESLint TypeScript config factory built on @kristijorgji/eslint-plugin",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "kristijorgji",
8
+ "engines": {
9
+ "node": ">=22.16.0"
10
+ },
5
11
  "publishConfig": {
6
- "access": "public"
12
+ "access": "public",
13
+ "provenance": false
7
14
  },
8
- "main": "index.js",
9
- "dependencies": {
10
- "@typescript-eslint/eslint-plugin": "^5.23.0",
11
- "@typescript-eslint/parser": "^5.23.0",
12
- "eslint": "^8.7.0",
13
- "eslint-config-prettier": "^8.3.0",
14
- "eslint-config-standard": "^17.0.0",
15
- "eslint-import-resolver-typescript": "^2.7.1",
16
- "eslint-plugin-import": "^2.25.4",
17
- "eslint-plugin-n": "^15.0.0",
18
- "eslint-plugin-prettier": "^4.0.0",
19
- "eslint-plugin-promise": "^6.0.0",
20
- "prettier": "2.6.2"
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/kristijorgji/js-devkit.git",
18
+ "directory": "packages/eslint-config-typescript"
21
19
  },
22
- "keywords": [
23
- "eslint",
24
- "typescript"
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
25
24
  ],
26
- "author": "kristijorgji",
27
- "license": "MIT"
28
- }
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ },
30
+ "./base": {
31
+ "types": "./dist/base.d.ts",
32
+ "import": "./dist/base.js"
33
+ },
34
+ "./typed": {
35
+ "types": "./dist/typed.d.ts",
36
+ "import": "./dist/typed.js"
37
+ },
38
+ "./ignores": {
39
+ "types": "./dist/ignores.d.ts",
40
+ "import": "./dist/ignores.js"
41
+ }
42
+ },
43
+ "types": "./dist/index.d.ts",
44
+ "peerDependencies": {
45
+ "eslint": "^9 || ^10",
46
+ "prettier": "^3",
47
+ "typescript": "^5 || ^6"
48
+ },
49
+ "dependencies": {
50
+ "@eslint/js": "^9",
51
+ "eslint-config-prettier": "^10",
52
+ "eslint-plugin-import-x": "^4",
53
+ "eslint-plugin-prettier": "^5",
54
+ "globals": "^16",
55
+ "typescript-eslint": "^8",
56
+ "@kristijorgji/eslint-plugin": "^0.1.0"
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "^22",
60
+ "eslint": "^9",
61
+ "prettier": "^3",
62
+ "typescript": "^5",
63
+ "vitest": "^3"
64
+ },
65
+ "scripts": {
66
+ "build": "tsc -p tsconfig.json",
67
+ "typecheck": "tsc -p tsconfig.json --noEmit",
68
+ "test": "vitest run",
69
+ "test:watch": "vitest"
70
+ }
71
+ }
package/index.js DELETED
@@ -1,60 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- jest: true,
6
- node: true,
7
- },
8
- extends: ['standard', 'eslint:recommended', 'prettier', 'plugin:import/recommended', 'plugin:import/typescript'],
9
- parser: '@typescript-eslint/parser',
10
- plugins: ['@typescript-eslint', 'eslint-plugin-prettier', 'eslint-plugin-import'],
11
- rules: {
12
- 'import/order': [
13
- 'error',
14
- {
15
- groups: ['builtin', 'external', 'internal', ['parent', 'sibling']],
16
- 'newlines-between': 'always',
17
- alphabetize: {
18
- order: 'asc',
19
- caseInsensitive: true,
20
- },
21
- },
22
- ],
23
- 'sort-imports': [
24
- 'error',
25
- {
26
- ignoreDeclarationSort: true,
27
- },
28
- ],
29
- 'import/no-unresolved': [
30
- 'error',
31
- ],
32
- 'import/no-extraneous-dependencies': [
33
- 'error',
34
- {
35
- devDependencies: ['{tests,__tests__,mocks,__mocks__}/**/*.ts'],
36
- bundledDependencies: true,
37
- optionalDependencies: false,
38
- peerDependencies: false,
39
- },
40
- ],
41
- '@typescript-eslint/no-explicit-any': 'error',
42
- quotes: ['error', 'single'],
43
- '@typescript-eslint/no-unused-vars': 'error',
44
- 'object-shorthand': 'off',
45
- 'prettier/prettier': [
46
- 'error',
47
- {
48
- arrowParens: 'avoid',
49
- bracketSpacing: true,
50
- printWidth: 120,
51
- semi: true,
52
- singleQuote: true,
53
- tabWidth: 4,
54
- trailingComma: 'all',
55
- useTabs: false,
56
- endOfLine: "lf"
57
- },
58
- ],
59
- },
60
- };