@tb-dev/eslint-config 7.1.2 → 7.1.4

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/dist/index.d.ts CHANGED
@@ -1,79 +1,2 @@
1
- /** @see https://eslint.org/docs/latest/use/configure/configuration-files-new#configuration-objects */
2
- declare interface ConfigObject {
3
- files: string[];
4
- ignores?: Ignores['ignores'];
5
- languageOptions?: {
6
- ecmaVersion?: 'latest';
7
- globals?: Record<string, boolean | 'readonly' | 'writeable'>;
8
- parser?: unknown;
9
- parserOptions?: Record<string, unknown>;
10
- sourceType?: 'module';
11
- };
12
- plugins?: Record<string, unknown>;
13
- processor?: unknown;
14
- rules: Rules;
15
- /** @see https://eslint.org/docs/latest/use/configure/configuration-files#configuring-shared-settings */
16
- settings?: Record<string, unknown>;
17
- }
18
-
19
- declare interface ConfigOptions {
20
- features?: FeaturesObject | (keyof FeaturesObject)[] | boolean;
21
- /** `tsconfig.json` files for TypeScript. */
22
- project: string[];
23
- ignores?: Ignores['ignores'];
24
- overrides?: {
25
- javascript?: Rules;
26
- perfectionist?: Rules;
27
- typescript?: Rules;
28
- unicorn?: Rules;
29
- vue?: Rules;
30
- };
31
- /**
32
- * @see https://typescript-eslint.io/rules/no-floating-promises/#allowforknownsafecalls
33
- */
34
- knownSafeCalls?: KnownSafeCalls[];
35
- /**
36
- * @see https://typescript-eslint.io/rules/no-floating-promises#allowforknownsafepromises
37
- */
38
- knownSafePromises?: KnownSafePromise[];
39
- /**
40
- * @see https://typescript-eslint.io/rules/explicit-module-boundary-types#configuring-in-a-mixed-jsts-codebase
41
- */
42
- moduleBoundaryTypesFiles?: string[];
43
- /**
44
- * @see https://github.com/jsx-eslint/eslint-plugin-react#configuration
45
- */
46
- reactVersion?: string;
47
- }
48
-
49
- export declare function defineConfig(options: ConfigOptions): Promise<Partial<ConfigObject>[]>;
50
-
51
- declare interface FeaturesObject {
52
- /** @default true */
53
- perfectionist?: boolean;
54
- /** @default true */
55
- unicorn?: boolean;
56
- /** @default false */
57
- vue?: boolean;
58
- }
59
-
60
- declare interface Ignores {
61
- ignores: string[];
62
- }
63
-
64
- declare type KnownSafeCalls = TypeOrValueSpecifier;
65
-
66
- declare type KnownSafePromise = TypeOrValueSpecifier;
67
-
68
- declare type Rules = Record<string, Severity | any[]>;
69
-
70
- declare type Severity = 'error' | 'warn' | 'off' | 0 | 1;
71
-
72
- declare interface TypeOrValueSpecifier {
73
- from: 'file' | 'lib' | 'package';
74
- name: string | string[];
75
- package?: string;
76
- path?: string;
77
- }
78
-
79
- export { }
1
+ import { ConfigObject, ConfigOptions } from './types';
2
+ export declare function defineConfig(options: ConfigOptions): Promise<Partial<ConfigObject>[]>;
package/dist/index.js CHANGED
@@ -21,13 +21,14 @@ var GlobIgnore = /* @__PURE__ */ ((GlobIgnore2) => {
21
21
  return GlobIgnore2;
22
22
  })(GlobIgnore || {});
23
23
 
24
+ const OPTIONAL_FEATURES = ["perfectionist", "unicorn", "vue"];
24
25
  async function interopDefault(promise) {
25
26
  const result = await promise;
26
27
  return result.default ?? result;
27
28
  }
28
29
  function isEnabled(config, feature) {
29
30
  if (Array.isArray(config)) {
30
- return config.includes(feature);
31
+ return OPTIONAL_FEATURES.includes(feature) ? config.includes(feature) : true;
31
32
  } else if (typeof config === "boolean") {
32
33
  return config;
33
34
  }
@@ -0,0 +1,5 @@
1
+ export * from './vue';
2
+ export * from './unicorn';
3
+ export * from './javascript';
4
+ export * from './typescript';
5
+ export * from './perfectionist';
@@ -0,0 +1,5 @@
1
+ import { ConfigObject, ConfigOptions } from '../types';
2
+ /**
3
+ * @see https://eslint.org/docs/latest/rules/
4
+ */
5
+ export declare function javascript(options: ConfigOptions): ConfigObject;
@@ -0,0 +1,5 @@
1
+ import { ConfigObject, ConfigOptions } from '../types';
2
+ /**
3
+ * @see https://eslint-plugin-perfectionist.azat.io/rules/
4
+ */
5
+ export declare function perfectionist(options: ConfigOptions): Promise<Partial<ConfigObject>>;
@@ -0,0 +1,5 @@
1
+ import { ConfigObject, ConfigOptions } from '../types';
2
+ /**
3
+ * @see https://typescript-eslint.io/rules/
4
+ */
5
+ export declare function typescript(options: ConfigOptions): Promise<ConfigObject[]>;
@@ -0,0 +1,5 @@
1
+ import { ConfigObject, ConfigOptions } from '../types';
2
+ /**
3
+ * @see https://github.com/sindresorhus/eslint-plugin-unicorn#rules
4
+ */
5
+ export declare function unicorn(options: ConfigOptions): Promise<Partial<ConfigObject>>;
@@ -0,0 +1,5 @@
1
+ import { ConfigObject, ConfigOptions } from '../types';
2
+ /**
3
+ * @see https://eslint.vuejs.org/rules/
4
+ */
5
+ export declare function vue(options: ConfigOptions): Promise<Partial<ConfigObject>[]>;
@@ -0,0 +1,68 @@
1
+ export interface FeaturesObject {
2
+ /** @default true */
3
+ perfectionist?: boolean;
4
+ /** @default true */
5
+ unicorn?: boolean;
6
+ /** @default false */
7
+ vue?: boolean;
8
+ }
9
+ export interface ConfigOptions {
10
+ features?: FeaturesObject | (keyof FeaturesObject)[] | boolean;
11
+ /** `tsconfig.json` files for TypeScript. */
12
+ project: string[];
13
+ ignores?: Ignores['ignores'];
14
+ overrides?: {
15
+ javascript?: Rules;
16
+ perfectionist?: Rules;
17
+ typescript?: Rules;
18
+ unicorn?: Rules;
19
+ vue?: Rules;
20
+ };
21
+ /**
22
+ * @see https://typescript-eslint.io/rules/no-floating-promises/#allowforknownsafecalls
23
+ */
24
+ knownSafeCalls?: KnownSafeCalls[];
25
+ /**
26
+ * @see https://typescript-eslint.io/rules/no-floating-promises#allowforknownsafepromises
27
+ */
28
+ knownSafePromises?: KnownSafePromise[];
29
+ /**
30
+ * @see https://typescript-eslint.io/rules/explicit-module-boundary-types#configuring-in-a-mixed-jsts-codebase
31
+ */
32
+ moduleBoundaryTypesFiles?: string[];
33
+ /**
34
+ * @see https://github.com/jsx-eslint/eslint-plugin-react#configuration
35
+ */
36
+ reactVersion?: string;
37
+ }
38
+ export interface Ignores {
39
+ ignores: string[];
40
+ }
41
+ export type Severity = 'error' | 'warn' | 'off' | 0 | 1;
42
+ export type Rules = Record<string, Severity | any[]>;
43
+ interface TypeOrValueSpecifier {
44
+ from: 'file' | 'lib' | 'package';
45
+ name: string | string[];
46
+ package?: string;
47
+ path?: string;
48
+ }
49
+ export type KnownSafePromise = TypeOrValueSpecifier;
50
+ export type KnownSafeCalls = TypeOrValueSpecifier;
51
+ /** @see https://eslint.org/docs/latest/use/configure/configuration-files-new#configuration-objects */
52
+ export interface ConfigObject {
53
+ files: string[];
54
+ ignores?: Ignores['ignores'];
55
+ languageOptions?: {
56
+ ecmaVersion?: 'latest';
57
+ globals?: Record<string, boolean | 'readonly' | 'writeable'>;
58
+ parser?: unknown;
59
+ parserOptions?: Record<string, unknown>;
60
+ sourceType?: 'module';
61
+ };
62
+ plugins?: Record<string, unknown>;
63
+ processor?: unknown;
64
+ rules: Rules;
65
+ /** @see https://eslint.org/docs/latest/use/configure/configuration-files#configuring-shared-settings */
66
+ settings?: Record<string, unknown>;
67
+ }
68
+ export {};
@@ -0,0 +1 @@
1
+ export type * from './config';
@@ -0,0 +1,17 @@
1
+ export declare enum Glob {
2
+ All = "**/*.?([cm])[jt]s?(x)",
3
+ Html = "**/*.html",
4
+ Javascript = "**/*.?([cm])js?(x)",
5
+ Typescript = "**/*.?([cm])ts?(x)",
6
+ Vue = "**/*.vue"
7
+ }
8
+ export declare enum GlobIgnore {
9
+ Autogenerated = "**/autogenerated",
10
+ Cache = "**/cache",
11
+ Dist = "**/dist",
12
+ Log = "**/log?(s)",
13
+ NodeModules = "**/node_modules",
14
+ Out = "**/out",
15
+ Target = "**/target",
16
+ Temp = "**/?(.)temp"
17
+ }
@@ -0,0 +1,6 @@
1
+ import { ConfigOptions, FeaturesObject } from '../types';
2
+ export * from './enum';
3
+ export declare function interopDefault(promise: Promise<any>): Promise<unknown>;
4
+ export declare function isEnabled(config: ConfigOptions['features'], feature: keyof FeaturesObject): boolean;
5
+ export declare function json<T>(path: string): Promise<T>;
6
+ export declare function getIgnores(): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/eslint-config",
3
- "version": "7.1.2",
3
+ "version": "7.1.4",
4
4
  "description": "ESLint config",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,22 +21,22 @@
21
21
  "vue"
22
22
  ],
23
23
  "dependencies": {
24
- "@typescript-eslint/eslint-plugin": "^8.32.0",
25
- "@typescript-eslint/parser": "^8.32.0",
26
- "eslint-plugin-perfectionist": "^4.12.3",
24
+ "@typescript-eslint/eslint-plugin": "^8.32.1",
25
+ "@typescript-eslint/parser": "^8.32.1",
26
+ "eslint-plugin-perfectionist": "^4.13.0",
27
27
  "eslint-plugin-unicorn": "^59.0.1",
28
28
  "eslint-plugin-vue": "^10.1.0",
29
- "globals": "^16.0.0",
29
+ "globals": "^16.1.0",
30
30
  "vue-eslint-parser": "^10.1.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/node": "^22.15.12",
34
- "eslint": "^9.26.0",
33
+ "@types/node": "^22.15.19",
34
+ "eslint": "^9.27.0",
35
35
  "prettier": "^3.5.3",
36
36
  "tslib": "^2.8.1",
37
37
  "typescript": "^5.8.3",
38
38
  "vite": "^6.3.5",
39
- "vite-plugin-dts": "^4.5.3"
39
+ "vite-plugin-dts": "^4.5.4"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=22"