@dpuse/eslint-config-dpuse 1.0.95 → 1.0.98

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/config.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "id": "eslint-config-dpuse",
3
- "version": "1.0.95"
3
+ "version": "1.0.98"
4
4
  }
package/dist/index.d.ts CHANGED
@@ -5,14 +5,14 @@ export interface DPUseESLintConfigOptions {
5
5
  files?: string[];
6
6
  /** Extra glob patterns to ignore, on top of the standard DPUse build/report directories. */
7
7
  ignores?: string[];
8
- /** Module specifiers that `import-x` should treat as resolvable core modules (e.g. `cloudflare:workers`). */
8
+ /** Module specifiers that `import-x` should treat as resolvable core modules. Defaults to `cloudflare:workers`, used by all DPUse Workers projects. */
9
9
  importCoreModules?: string[];
10
10
  /** Project-specific rule overrides, applied last so they take precedence over the shared defaults. */
11
11
  rules?: Linter.RulesRecord;
12
- /** Path to the consuming project's `tsconfig.json`, used for typed linting and import resolution. */
13
- tsconfigPath: string;
14
- /** The consuming project's root directory, e.g. `import.meta.dirname` from its own `eslint.config.ts`. */
15
- tsconfigRootDir: string;
12
+ /** Path to the consuming project's `tsconfig.json`. Defaults to `./tsconfig.json`, used by every DPUse project. */
13
+ tsconfigPath?: string;
14
+ /** The consuming project's root directory. Defaults to `process.cwd()`, correct as long as ESLint is run from the project root. */
15
+ tsconfigRootDir?: string;
16
16
  }
17
17
  export declare function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Config[];
18
18
  export default dpuseESLintConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAarC,yEAAyE;AACzE,MAAM,WAAW,wBAAwB;IACrC,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,6GAA6G;IAC7G,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,sGAAsG;IACtG,KAAK,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;IAC3B,qGAAqG;IACrG,YAAY,EAAE,MAAM,CAAC;IACrB,0GAA0G;IAC1G,eAAe,EAAE,MAAM,CAAC;CAC3B;AAID,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,CAkEpF;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAarC,yEAAyE;AACzE,MAAM,WAAW,wBAAwB;IACrC,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,uJAAuJ;IACvJ,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,sGAAsG;IACtG,KAAK,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;IAC3B,mHAAmH;IACnH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mIAAmI;IACnI,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAID,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,CAyEpF;AAED,eAAe,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -9,14 +9,14 @@ import tseslint from 'typescript-eslint';
9
9
  import { defineConfig, globalIgnores } from 'eslint/config';
10
10
  // ── ESLint Configuration ─────────────────────────────────────────────────────────────────────────────────────────────
11
11
  export function dpuseESLintConfig(options) {
12
- const { files = ['eslint.config.*', 'src/**/*.ts'], ignores = [], importCoreModules = [], rules = {}, tsconfigPath, tsconfigRootDir } = options;
12
+ const { files = ['eslint.config.*', 'src/**/*.ts', 'vite.config.ts', 'vitest.config.ts'], ignores = [], importCoreModules = ['cloudflare:workers'], rules = {}, tsconfigPath = './tsconfig.json', tsconfigRootDir: tsconfigRootDirectory = process.cwd() } = options;
13
13
  return defineConfig(
14
14
  // Linting scope, strict TypeScript type-checking, and module resolver.
15
15
  {
16
16
  files,
17
17
  extends: [...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
18
18
  languageOptions: {
19
- parserOptions: { project: tsconfigPath, tsconfigRootDir }
19
+ parserOptions: { project: tsconfigPath, tsconfigRootDir: tsconfigRootDirectory }
20
20
  },
21
21
  settings: {
22
22
  'import-x/core-modules': importCoreModules,
@@ -46,13 +46,13 @@ export function dpuseESLintConfig(options) {
46
46
  'sort-imports': ['warn', { allowSeparatedGroups: true, ignoreCase: true, memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'] }],
47
47
  '@typescript-eslint/no-unused-vars': 'warn',
48
48
  '@eslint-community/eslint-comments/require-description': 'warn',
49
- 'security/detect-object-injection': 'off',
49
+ 'security/detect-object-injection': 'off', // Generates too many false positives.
50
50
  'sonarjs/no-commented-code': 'warn',
51
51
  'sonarjs/no-dead-store': 'warn',
52
52
  'sonarjs/no-unused-vars': 'warn',
53
53
  'sonarjs/todo-tag': 'warn',
54
54
  'unicorn/filename-case': ['error', { cases: { camelCase: true, pascalCase: true } }],
55
- 'unicorn/no-null': 'off',
55
+ 'unicorn/no-null': 'off', // Null is required for JSON interop.
56
56
  'unicorn/switch-case-braces': ['warn', 'avoid'],
57
57
  ...rules
58
58
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,OAAO,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AAO;YAClE,wDAAwD,EAAE,OAAO;YACjE,wDAAwD,EAAE,OAAO;YACjE,oDAAoD,EAAE,OAAO;SAChE;KACJ,EACD,uBAAuB,CAAC,WAAW,EACnC,mBAAmB,CAAC,kBAAkB,CAAC,EACvC,cAAc,CAAC,OAAO,CAAC,WAAW,EAClC,aAAa,CAAC,OAAO,CAAC,WAAW,EACjC,aAAa,CAAC,OAAO,CAAC,WAAW,EACjC,cAAc;IAEd,kBAAkB;IAClB;QACI,KAAK;QACL,KAAK,EAAE;YACH,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,CAAC;YAExI,mCAAmC,EAAE,MAAM;YAE3C,uDAAuD,EAAE,MAAM;YAE/D,kCAAkC,EAAE,KAAK,EAAE,sCAAsC;YAEjF,2BAA2B,EAAE,MAAM;YACnC,uBAAuB,EAAE,MAAM;YAC/B,wBAAwB,EAAE,MAAM;YAChC,kBAAkB,EAAE,MAAM;YAE1B,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;YACpF,iBAAiB,EAAE,KAAK,EAAE,qCAAqC;YAC/D,4BAA4B,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YAE/C,GAAG,KAAK;SACX;KACJ,CACJ,CAAC;AACN,CAAC;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Linter } from 'eslint';
2
+ /** Options accepted by the shared DPUse ESLint configuration factory. */
3
+ export interface DPUseESLintConfigOptions {
4
+ /** Glob patterns for the files to type-check. Defaults to the common DPUse project layout. */
5
+ files?: string[];
6
+ /** Extra glob patterns to ignore, on top of the standard DPUse build/report directories. */
7
+ ignores?: string[];
8
+ /** Module specifiers that `import-x` should treat as resolvable core modules (e.g. `cloudflare:workers`). */
9
+ importCoreModules?: string[];
10
+ /** Project-specific rule overrides, applied last so they take precedence over the shared defaults. */
11
+ rules?: Linter.RulesRecord;
12
+ /** Path to the consuming project's `tsconfig.json`, used for typed linting and import resolution. */
13
+ tsconfigPath: string;
14
+ /** The consuming project's root directory, e.g. `import.meta.dirname` from its own `eslint.config.ts`. */
15
+ tsconfigRootDir: string;
16
+ }
17
+ export declare function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Config[];
18
+ export default dpuseESLintConfig;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAarC,yEAAyE;AACzE,MAAM,WAAW,wBAAwB;IACrC,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,6GAA6G;IAC7G,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,sGAAsG;IACtG,KAAK,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;IAC3B,qGAAqG;IACrG,YAAY,EAAE,MAAM,CAAC;IACrB,0GAA0G;IAC1G,eAAe,EAAE,MAAM,CAAC;CAC3B;AAID,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,CAkEpF;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,62 @@
1
+ import pluginComments from '@eslint-community/eslint-plugin-eslint-comments';
2
+ import { flatConfigs as pluginImportFlatConfigs } from 'eslint-plugin-import-x';
3
+ import { configs as pluginRegexpConfigs } from 'eslint-plugin-regexp';
4
+ import pluginSecurity from 'eslint-plugin-security';
5
+ import pluginSonarJS from 'eslint-plugin-sonarjs';
6
+ import pluginUnicorn from 'eslint-plugin-unicorn';
7
+ import skipFormatting from 'eslint-config-prettier';
8
+ import tseslint from 'typescript-eslint';
9
+ import { defineConfig, globalIgnores } from 'eslint/config';
10
+ // ── ESLint Configuration ─────────────────────────────────────────────────────────────────────────────────────────────
11
+ export function dpuseESLintConfig(options) {
12
+ const { files = ['eslint.config.*', 'src/**/*.ts'], ignores = [], importCoreModules = [], rules = {}, tsconfigPath, tsconfigRootDir } = options;
13
+ return defineConfig(
14
+ // Linting scope, strict TypeScript type-checking, and module resolver.
15
+ {
16
+ files,
17
+ extends: [...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
18
+ languageOptions: {
19
+ parserOptions: { project: tsconfigPath, tsconfigRootDir }
20
+ },
21
+ settings: {
22
+ 'import-x/core-modules': importCoreModules,
23
+ 'import-x/resolver': {
24
+ typescript: { project: [tsconfigPath] }
25
+ }
26
+ }
27
+ },
28
+ // Ignores.
29
+ globalIgnores(['bundle-analysis-reports/**', 'dependency-check-bin/**', 'dependency-check-reports/**', 'dist/**', 'licenses/**', ...ignores]),
30
+ // Plugin configurations.
31
+ {
32
+ // '@eslint-community/eslint-comments' only ships a legacy config; manually convert to flat format.
33
+ plugins: { '@eslint-community/eslint-comments': pluginComments },
34
+ rules: {
35
+ '@eslint-community/eslint-comments/disable-enable-pair': 'error',
36
+ '@eslint-community/eslint-comments/no-aggregating-enable': 'error',
37
+ '@eslint-community/eslint-comments/no-duplicate-disable': 'error',
38
+ '@eslint-community/eslint-comments/no-unlimited-disable': 'error',
39
+ '@eslint-community/eslint-comments/no-unused-enable': 'error'
40
+ }
41
+ }, pluginImportFlatConfigs.recommended, pluginRegexpConfigs['flat/recommended'], pluginSecurity.configs.recommended, pluginSonarJS.configs.recommended, pluginUnicorn.configs.recommended, skipFormatting,
42
+ // Rule overrides.
43
+ {
44
+ files,
45
+ rules: {
46
+ 'sort-imports': ['warn', { allowSeparatedGroups: true, ignoreCase: true, memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'] }],
47
+ '@typescript-eslint/no-unused-vars': 'warn',
48
+ '@eslint-community/eslint-comments/require-description': 'warn',
49
+ 'security/detect-object-injection': 'off',
50
+ 'sonarjs/no-commented-code': 'warn',
51
+ 'sonarjs/no-dead-store': 'warn',
52
+ 'sonarjs/no-unused-vars': 'warn',
53
+ 'sonarjs/todo-tag': 'warn',
54
+ 'unicorn/filename-case': ['error', { cases: { camelCase: true, pascalCase: true } }],
55
+ 'unicorn/no-null': 'off',
56
+ 'unicorn/switch-case-braces': ['warn', 'avoid'],
57
+ ...rules
58
+ }
59
+ });
60
+ }
61
+ export default dpuseESLintConfig;
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAoB5D,wHAAwH;AAExH,MAAM,UAAU,iBAAiB,CAAC,OAAiC;IAC/D,MAAM,EAAE,KAAK,GAAG,CAAC,iBAAiB,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,EAAE,EAAE,iBAAiB,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEhJ,OAAO,YAAY;IACf,uEAAuE;IACvE;QAC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,MAAM;YACnC,uBAAuB,EAAE,MAAM;YAC/B,wBAAwB,EAAE,MAAM;YAChC,kBAAkB,EAAE,MAAM;YAE1B,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;YACpF,iBAAiB,EAAE,KAAK;YACxB,4BAA4B,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;YAE/C,GAAG,KAAK;SACX;KACJ,CACJ,CAAC;AACN,CAAC;AAED,eAAe,iBAAiB,CAAC"}
package/eslint.config.js CHANGED
@@ -4,6 +4,6 @@ import { dpuseESLintConfig } from './src/index.ts';
4
4
  // ── DPUse ESLint Configuration ───────────────────────────────────────────────────────────────────────────────────────
5
5
 
6
6
  /** @type {import('eslint').Linter.Config[]} */
7
- const config = dpuseESLintConfig({ tsconfigPath: './tsconfig.json', tsconfigRootDir: import.meta.dirname });
7
+ const config = dpuseESLintConfig({});
8
8
 
9
9
  export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpuse/eslint-config-dpuse",
3
- "version": "1.0.95",
3
+ "version": "1.0.98",
4
4
  "private": false,
5
5
  "description": "Common ESLint configuration used in most DPUse projects.",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  "typescript-eslint": "^8.62.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@dpuse/dpuse-development": "^0.3.646",
48
+ "@dpuse/dpuse-development": "^0.3.647",
49
49
  "@types/eslint-plugin-security": "^3.0.1",
50
50
  "@types/node": "^26.1.0",
51
51
  "eslint": "^10.6.0",
package/src/index.ts CHANGED
@@ -18,20 +18,27 @@ export interface DPUseESLintConfigOptions {
18
18
  files?: string[];
19
19
  /** Extra glob patterns to ignore, on top of the standard DPUse build/report directories. */
20
20
  ignores?: string[];
21
- /** Module specifiers that `import-x` should treat as resolvable core modules (e.g. `cloudflare:workers`). */
21
+ /** Module specifiers that `import-x` should treat as resolvable core modules. Defaults to `cloudflare:workers`, used by all DPUse Workers projects. */
22
22
  importCoreModules?: string[];
23
23
  /** Project-specific rule overrides, applied last so they take precedence over the shared defaults. */
24
24
  rules?: Linter.RulesRecord;
25
- /** Path to the consuming project's `tsconfig.json`, used for typed linting and import resolution. */
26
- tsconfigPath: string;
27
- /** The consuming project's root directory, e.g. `import.meta.dirname` from its own `eslint.config.ts`. */
28
- tsconfigRootDir: string;
25
+ /** Path to the consuming project's `tsconfig.json`. Defaults to `./tsconfig.json`, used by every DPUse project. */
26
+ tsconfigPath?: string;
27
+ /** The consuming project's root directory. Defaults to `process.cwd()`, correct as long as ESLint is run from the project root. */
28
+ tsconfigRootDir?: string;
29
29
  }
30
30
 
31
31
  // ── ESLint Configuration ─────────────────────────────────────────────────────────────────────────────────────────────
32
32
 
33
33
  export function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Config[] {
34
- const { files = ['eslint.config.*', 'src/**/*.ts'], ignores = [], importCoreModules = [], rules = {}, tsconfigPath, tsconfigRootDir } = options;
34
+ const {
35
+ files = ['eslint.config.*', 'src/**/*.ts', 'vite.config.ts', 'vitest.config.ts'],
36
+ ignores = [],
37
+ importCoreModules = ['cloudflare:workers'],
38
+ rules = {},
39
+ tsconfigPath = './tsconfig.json',
40
+ tsconfigRootDir: tsconfigRootDirectory = process.cwd()
41
+ } = options;
35
42
 
36
43
  return defineConfig(
37
44
  // Linting scope, strict TypeScript type-checking, and module resolver.
@@ -39,7 +46,7 @@ export function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Con
39
46
  files,
40
47
  extends: [...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
41
48
  languageOptions: {
42
- parserOptions: { project: tsconfigPath, tsconfigRootDir }
49
+ parserOptions: { project: tsconfigPath, tsconfigRootDir: tsconfigRootDirectory }
43
50
  },
44
51
  settings: {
45
52
  'import-x/core-modules': importCoreModules,
@@ -81,7 +88,7 @@ export function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Con
81
88
 
82
89
  '@eslint-community/eslint-comments/require-description': 'warn',
83
90
 
84
- 'security/detect-object-injection': 'off',
91
+ 'security/detect-object-injection': 'off', // Generates too many false positives.
85
92
 
86
93
  'sonarjs/no-commented-code': 'warn',
87
94
  'sonarjs/no-dead-store': 'warn',
@@ -89,7 +96,7 @@ export function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Con
89
96
  'sonarjs/todo-tag': 'warn',
90
97
 
91
98
  'unicorn/filename-case': ['error', { cases: { camelCase: true, pascalCase: true } }],
92
- 'unicorn/no-null': 'off',
99
+ 'unicorn/no-null': 'off', // Null is required for JSON interop.
93
100
  'unicorn/switch-case-braces': ['warn', 'avoid'],
94
101
 
95
102
  ...rules
@@ -4,28 +4,23 @@
4
4
  "declarationMap": true,
5
5
  "esModuleInterop": true,
6
6
  "exactOptionalPropertyTypes": true,
7
- "forceConsistentCasingInFileNames": true,
8
7
  "incremental": true,
9
8
  "lib": ["ESNext"],
10
9
  "module": "NodeNext",
11
10
  "moduleDetection": "force",
12
- "moduleResolution": "nodenext",
13
- "noImplicitAny": true,
11
+ "moduleResolution": "NodeNext",
14
12
  "noImplicitOverride": true,
15
13
  "noPropertyAccessFromIndexSignature": true,
16
14
  "noUncheckedIndexedAccess": true,
17
- "noUnusedLocals": true,
18
- "noUnusedParameters": true,
19
15
  "outDir": "dist",
20
16
  "resolveJsonModule": true,
21
17
  "rootDir": "src",
22
18
  "skipLibCheck": true,
23
19
  "sourceMap": true,
24
20
  "strict": true,
25
- "strictNullChecks": true,
26
21
  "target": "ESNext",
27
22
  "tsBuildInfoFile": "./node_modules/.cache/tsconfig.build.tsbuildinfo",
28
- "useDefineForClassFields": true,
23
+ "types": ["node"],
29
24
  "verbatimModuleSyntax": true
30
25
  },
31
26
  "include": ["src/**/*.ts"]
package/tsconfig.json CHANGED
@@ -1,38 +1,26 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "declaration": true,
4
- "declarationMap": true,
3
+ "allowJs": true,
4
+ "allowImportingTsExtensions": true,
5
5
  "esModuleInterop": true,
6
6
  "exactOptionalPropertyTypes": true,
7
- "forceConsistentCasingInFileNames": true,
8
7
  "incremental": true,
9
8
  "lib": ["ESNext"],
10
9
  "module": "NodeNext",
11
10
  "moduleDetection": "force",
12
- "moduleResolution": "nodenext",
13
- "noImplicitAny": true,
11
+ "moduleResolution": "NodeNext",
12
+ "noEmit": true,
14
13
  "noImplicitOverride": true,
15
14
  "noPropertyAccessFromIndexSignature": true,
16
15
  "noUncheckedIndexedAccess": true,
17
- "noUnusedLocals": true,
18
- "noUnusedParameters": true,
19
- "outDir": "dist",
16
+ "paths": { "@/*": ["./src/*"] },
20
17
  "resolveJsonModule": true,
21
18
  "skipLibCheck": true,
22
- "sourceMap": true,
23
19
  "strict": true,
24
- "strictNullChecks": true,
25
20
  "target": "ESNext",
26
21
  "tsBuildInfoFile": "./node_modules/.cache/tsconfig.tsbuildinfo",
27
- "useDefineForClassFields": true,
28
- "verbatimModuleSyntax": true,
29
- "noEmit": true,
30
- "allowJs": true,
31
- "allowImportingTsExtensions": true,
32
22
  "types": ["node"],
33
- "paths": {
34
- "@/*": ["./src/*"]
35
- }
23
+ "verbatimModuleSyntax": true
36
24
  },
37
- "include": ["eslint.config.*", "src/**/*.ts"]
25
+ "include": ["eslint.config.js", "src/**/*.ts"]
38
26
  }