js-style-kit 0.2.10 → 0.2.12
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 +126 -9
- package/package.json +11 -11
- package/dist/eslint/base/config.d.ts +0 -17
- package/dist/eslint/base/config.js +0 -457
- package/dist/eslint/base/config.js.map +0 -1
- package/dist/eslint/base/rules.d.ts +0 -18
- package/dist/eslint/base/rules.js +0 -425
- package/dist/eslint/base/rules.js.map +0 -1
- package/dist/eslint/base/types.d.ts +0 -21
- package/dist/eslint/base/types.js +0 -1
- package/dist/eslint/base/types.js.map +0 -1
- package/dist/eslint/constants.d.ts +0 -28
- package/dist/eslint/constants.js +0 -25
- package/dist/eslint/constants.js.map +0 -1
- package/dist/eslint/ignores.d.ts +0 -19
- package/dist/eslint/ignores.js +0 -42
- package/dist/eslint/ignores.js.map +0 -1
- package/dist/eslint/index.d.ts +0 -55
- package/dist/eslint/index.js +0 -1410
- package/dist/eslint/index.js.map +0 -1
- package/dist/eslint/jsdoc/config.d.ts +0 -14
- package/dist/eslint/jsdoc/config.js +0 -109
- package/dist/eslint/jsdoc/config.js.map +0 -1
- package/dist/eslint/jsdoc/rules.d.ts +0 -15
- package/dist/eslint/jsdoc/rules.js +0 -73
- package/dist/eslint/jsdoc/rules.js.map +0 -1
- package/dist/eslint/jsdoc/types.d.ts +0 -52
- package/dist/eslint/jsdoc/types.js +0 -1
- package/dist/eslint/jsdoc/types.js.map +0 -1
- package/dist/eslint/nextjs/config.d.ts +0 -12
- package/dist/eslint/nextjs/config.js +0 -62
- package/dist/eslint/nextjs/config.js.map +0 -1
- package/dist/eslint/nextjs/rules.d.ts +0 -8
- package/dist/eslint/nextjs/rules.js +0 -28
- package/dist/eslint/nextjs/rules.js.map +0 -1
- package/dist/eslint/nextjs/types.d.ts +0 -29
- package/dist/eslint/nextjs/types.js +0 -1
- package/dist/eslint/nextjs/types.js.map +0 -1
- package/dist/eslint/perfectionist/config.d.ts +0 -7
- package/dist/eslint/perfectionist/config.js +0 -65
- package/dist/eslint/perfectionist/config.js.map +0 -1
- package/dist/eslint/perfectionist/rules.d.ts +0 -12
- package/dist/eslint/perfectionist/rules.js +0 -31
- package/dist/eslint/perfectionist/rules.js.map +0 -1
- package/dist/eslint/prefer-arrow-function/config.d.ts +0 -12
- package/dist/eslint/prefer-arrow-function/config.js +0 -45
- package/dist/eslint/prefer-arrow-function/config.js.map +0 -1
- package/dist/eslint/prefer-arrow-function/types.d.ts +0 -17
- package/dist/eslint/prefer-arrow-function/types.js +0 -1
- package/dist/eslint/prefer-arrow-function/types.js.map +0 -1
- package/dist/eslint/react/config.d.ts +0 -18
- package/dist/eslint/react/config.js +0 -186
- package/dist/eslint/react/config.js.map +0 -1
- package/dist/eslint/react/rules.d.ts +0 -26
- package/dist/eslint/react/rules.js +0 -132
- package/dist/eslint/react/rules.js.map +0 -1
- package/dist/eslint/react-compiler/config.d.ts +0 -12
- package/dist/eslint/react-compiler/config.js +0 -39
- package/dist/eslint/react-compiler/config.js.map +0 -1
- package/dist/eslint/react-refresh/config.d.ts +0 -16
- package/dist/eslint/react-refresh/config.js +0 -55
- package/dist/eslint/react-refresh/config.js.map +0 -1
- package/dist/eslint/react-refresh/rules.d.ts +0 -38
- package/dist/eslint/react-refresh/rules.js +0 -19
- package/dist/eslint/react-refresh/rules.js.map +0 -1
- package/dist/eslint/storybook/config.d.ts +0 -13
- package/dist/eslint/storybook/config.js +0 -67
- package/dist/eslint/storybook/config.js.map +0 -1
- package/dist/eslint/testing/config.d.ts +0 -25
- package/dist/eslint/testing/config.js +0 -169
- package/dist/eslint/testing/config.js.map +0 -1
- package/dist/eslint/testing/jest-rules.d.ts +0 -14
- package/dist/eslint/testing/jest-rules.js +0 -44
- package/dist/eslint/testing/jest-rules.js.map +0 -1
- package/dist/eslint/testing/vitest-rules.d.ts +0 -14
- package/dist/eslint/testing/vitest-rules.js +0 -50
- package/dist/eslint/testing/vitest-rules.js.map +0 -1
- package/dist/eslint/turbo/config.d.ts +0 -12
- package/dist/eslint/turbo/config.js +0 -39
- package/dist/eslint/turbo/config.js.map +0 -1
- package/dist/eslint/turbo/types.d.ts +0 -11
- package/dist/eslint/turbo/types.js +0 -1
- package/dist/eslint/turbo/types.js.map +0 -1
- package/dist/eslint/types.d.ts +0 -11
- package/dist/eslint/types.js +0 -1
- package/dist/eslint/types.js.map +0 -1
- package/dist/eslint/typescript/config.d.ts +0 -11
- package/dist/eslint/typescript/config.js +0 -186
- package/dist/eslint/typescript/config.js.map +0 -1
- package/dist/eslint/typescript/rules.d.ts +0 -8
- package/dist/eslint/typescript/rules.js +0 -135
- package/dist/eslint/typescript/rules.js.map +0 -1
- package/dist/eslint/typescript/types.d.ts +0 -7
- package/dist/eslint/typescript/types.js +0 -1
- package/dist/eslint/typescript/types.js.map +0 -1
- package/dist/eslint/unicorn/config.d.ts +0 -11
- package/dist/eslint/unicorn/config.js +0 -113
- package/dist/eslint/unicorn/config.js.map +0 -1
- package/dist/eslint/unicorn/rules.d.ts +0 -8
- package/dist/eslint/unicorn/rules.js +0 -79
- package/dist/eslint/unicorn/rules.js.map +0 -1
- package/dist/modules.d.d.ts +0 -3
- package/dist/modules.d.js +0 -1
- package/dist/modules.d.js.map +0 -1
- package/dist/prettier/index.d.ts +0 -34
- package/dist/prettier/index.js +0 -132
- package/dist/prettier/index.js.map +0 -1
- package/dist/prettier/patch-tailwind-plugin.d.ts +0 -9
- package/dist/prettier/patch-tailwind-plugin.js +0 -72
- package/dist/prettier/patch-tailwind-plugin.js.map +0 -1
- package/dist/utils/is-type.d.ts +0 -44
- package/dist/utils/is-type.js +0 -28
- package/dist/utils/is-type.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
import { Config } from 'prettier';
|
|
3
|
+
import { SortJsonOptions } from 'prettier-plugin-sort-json';
|
|
4
|
+
import { PluginOptions } from 'prettier-plugin-tailwindcss';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Debug names for ESLint configuration objects.
|
|
8
|
+
* These names help identify different configuration sections in ESLint's debug output
|
|
9
|
+
* and error messages, making it easier to track which rules come from which config.
|
|
10
|
+
*/
|
|
11
|
+
declare const configNames: {
|
|
12
|
+
readonly base: "base";
|
|
13
|
+
readonly disableTypeChecked: "typescript-eslint/disable-type-checked";
|
|
14
|
+
readonly ignores: "ignores";
|
|
15
|
+
readonly jsdoc: "jsdoc";
|
|
16
|
+
readonly markdown: "markdown";
|
|
17
|
+
readonly nextjs: "nextjs";
|
|
18
|
+
readonly perfectionist: "perfectionist";
|
|
19
|
+
readonly preferArrowFunction: "prefer-arrow-function";
|
|
20
|
+
readonly react: "react";
|
|
21
|
+
readonly reactCompiler: "react-compiler";
|
|
22
|
+
readonly reactRefresh: "react-refresh";
|
|
23
|
+
readonly storybook: "storybook:stories";
|
|
24
|
+
readonly storybookConfig: "storybook:config";
|
|
25
|
+
readonly testing: "testing";
|
|
26
|
+
readonly turbo: "turbo";
|
|
27
|
+
readonly typescript: "tseslint";
|
|
28
|
+
readonly typescriptTesting: "tseslint-testing";
|
|
29
|
+
readonly unicorn: "unicorn";
|
|
30
|
+
};
|
|
31
|
+
type ConfigName = (typeof configNames)[keyof typeof configNames];
|
|
32
|
+
|
|
33
|
+
type EslintSeverity = 0 | 1 | 2 | "error" | "off" | "warn";
|
|
34
|
+
type EslintRuleConfig<TOptions = Record<string, unknown>, TOptions2 = Record<string, unknown>> = [EslintSeverity, string | TOptions | undefined] | [EslintSeverity, string | undefined, TOptions2 | undefined] | [EslintSeverity, TOptions | undefined, TOptions2 | undefined] | [EslintSeverity] | EslintSeverity;
|
|
35
|
+
type FunctionStyle = "arrow" | "declaration" | "expression";
|
|
36
|
+
interface EslintConfigObject<Rules extends Linter.RulesRecord = Linter.RulesRecord> extends Linter.Config<Rules> {
|
|
37
|
+
name: ConfigName;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface TestingConfig {
|
|
41
|
+
filenamePattern?: "spec" | "test";
|
|
42
|
+
files?: string[];
|
|
43
|
+
formattingRules?: boolean;
|
|
44
|
+
framework?: "bun" | "jest" | "node" | "vitest";
|
|
45
|
+
itOrTest?: "it" | "test";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface EslintConfigOptions {
|
|
49
|
+
functionStyle?: "off" | FunctionStyle;
|
|
50
|
+
ignores?: string[];
|
|
51
|
+
jsdoc?: false | {
|
|
52
|
+
requireJsdoc?: boolean;
|
|
53
|
+
};
|
|
54
|
+
react?: boolean | {
|
|
55
|
+
framework?: "next" | "none" | "vite";
|
|
56
|
+
next?: boolean | undefined;
|
|
57
|
+
reactCompiler?: boolean | undefined;
|
|
58
|
+
reactRefresh?: boolean | undefined;
|
|
59
|
+
};
|
|
60
|
+
sorting?: boolean;
|
|
61
|
+
storybook?: boolean;
|
|
62
|
+
testing?: false | TestingConfig;
|
|
63
|
+
turbo?: boolean;
|
|
64
|
+
typescript?: boolean | string;
|
|
65
|
+
unicorn?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Configures ESLint based on provided options.
|
|
69
|
+
*
|
|
70
|
+
* @param options - The optional configuration object.
|
|
71
|
+
* @param options.functionStyle - The function style to enforce. Defaults to "arrow".
|
|
72
|
+
* @param options.ignores - Additional paths to ignore. Already excludes `node_modules` and `dist`.
|
|
73
|
+
* @param options.jsdoc - Whether to include JSDoc rules. Set to false to disable, or provide an object to configure.
|
|
74
|
+
* @param options.react - Whether to include React rules. When true, reactCompiler is enabled by default.
|
|
75
|
+
* Can be configured with an object to control next.js support and reactCompiler.
|
|
76
|
+
* Also controls reactRefresh, which is enabled by default when react is true.
|
|
77
|
+
* Can specify framework as "next", "none", or "vite" to control related configs:
|
|
78
|
+
* - "next": Includes Next.js config, excludes React Refresh.
|
|
79
|
+
* - "vite" or "none": Includes React Refresh, excludes Next.js.
|
|
80
|
+
* - The reactRefresh property can override this framework-based behavior.
|
|
81
|
+
* @param options.sorting - Whether to include sorting rules from Perfectionist. Defaults to true.
|
|
82
|
+
* @param options.storybook - Whether to include Storybook rules. Defaults to false.
|
|
83
|
+
* @param options.testing - An object with the following properties:
|
|
84
|
+
* - `filenamePattern`: One of "spec" or "test" to determine which filename pattern to use.
|
|
85
|
+
* - `files`: Array of file patterns to include in the configuration.
|
|
86
|
+
* - `framework`: One of "vitest" or "jest" to determine which testing library to use.
|
|
87
|
+
* - `formattingRules`: Whether to include formatting rules like padding around blocks.
|
|
88
|
+
* - `itOrTest`: One of "it" or "test" to determine which test function to use.
|
|
89
|
+
* @param options.typescript - Whether to include TypeScript rules. Can be a boolean or a string with path to tsconfig.
|
|
90
|
+
* @param options.turbo - Whether to include Turborepo rules. Defaults to false.
|
|
91
|
+
* @param options.unicorn - Whether to include Unicorn rules. Defaults to true.
|
|
92
|
+
* @param additionalConfigs - Additional ESLint config objects to be merged into the final configuration.
|
|
93
|
+
* @returns An array of ESLint configuration objects.
|
|
94
|
+
*/
|
|
95
|
+
declare const eslintConfig: ({ functionStyle, ignores, jsdoc, react, sorting, storybook, testing, turbo, typescript, unicorn, }?: EslintConfigOptions, ...additionalConfigs: Linter.Config[]) => Linter.Config[];
|
|
96
|
+
|
|
97
|
+
interface PrettierConfigOptions extends Config {
|
|
98
|
+
cssOrderPlugin?: boolean;
|
|
99
|
+
curlyPlugin?: boolean;
|
|
100
|
+
jsonSortPlugin?: boolean | SortJsonOptions;
|
|
101
|
+
packageJsonPlugin?: boolean;
|
|
102
|
+
tailwindPlugin?: boolean | string | PluginOptions;
|
|
103
|
+
}
|
|
104
|
+
interface PrettierConfigWithPlugins extends Config, SortJsonOptions, PluginOptions {
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Creates a Prettier configuration object with optional Tailwind support
|
|
108
|
+
*
|
|
109
|
+
* @param options - Configuration options for Prettier
|
|
110
|
+
* @param options.cssOrderPlugin CSS order sorting support
|
|
111
|
+
* @param options.curlyPlugin Enforce curly braces for all control statements
|
|
112
|
+
* @param options.jsonSortPlugin JSON sorting support
|
|
113
|
+
* @param options.packageJsonPlugin Package.json sorting support
|
|
114
|
+
* @param options.tailwindPlugin Tailwind CSS formatting support
|
|
115
|
+
* @returns Prettier configuration object with:
|
|
116
|
+
* - Default Prettier configuration
|
|
117
|
+
* - Experimental ternaries enabled
|
|
118
|
+
* - CSS order plugin
|
|
119
|
+
* - Curly braces plugin
|
|
120
|
+
* - JSON sorting plugin
|
|
121
|
+
* - Package.json sorting plugin
|
|
122
|
+
* - Optional Tailwind plugin and functions
|
|
123
|
+
*/
|
|
124
|
+
declare const prettierConfig: (options?: PrettierConfigOptions) => PrettierConfigWithPlugins;
|
|
125
|
+
|
|
126
|
+
export { type EslintConfigObject, type EslintConfigOptions, type EslintRuleConfig, type EslintSeverity, type FunctionStyle, type PrettierConfigOptions, type PrettierConfigWithPlugins, eslintConfig, prettierConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-style-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "A zero configuration style guide for ESLint and Prettier",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsup",
|
|
32
32
|
"dev": "tsup --watch",
|
|
33
|
-
"format": "prettier
|
|
34
|
-
"format:check": "prettier
|
|
33
|
+
"format": "prettier . --write --cache",
|
|
34
|
+
"format:check": "prettier . --check --cache",
|
|
35
35
|
"lint": "eslint .",
|
|
36
36
|
"lint:fix": "eslint . --fix",
|
|
37
37
|
"lint:inspect": "eslint --inspect-config",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"test:coverage": "bun test --coverage --coverage-reporter=lcov"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"eslint": "^9.
|
|
42
|
+
"eslint": "^9.24.0",
|
|
43
43
|
"eslint-plugin-jest": "^28.11.0",
|
|
44
44
|
"eslint-plugin-jsdoc": "^50.6.9",
|
|
45
|
-
"eslint-plugin-nextjs": "^0.
|
|
46
|
-
"eslint-plugin-perfectionist": "^4.
|
|
45
|
+
"eslint-plugin-nextjs": "^1.0.0",
|
|
46
|
+
"eslint-plugin-perfectionist": "^4.11.0",
|
|
47
47
|
"eslint-plugin-prefer-arrow-functions": "^3.6.2",
|
|
48
|
-
"eslint-plugin-react": "^7.37.
|
|
48
|
+
"eslint-plugin-react": "^7.37.5",
|
|
49
49
|
"eslint-plugin-react-compiler": "19.0.0-beta-bafa41b-20250307",
|
|
50
50
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
51
51
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
@@ -56,19 +56,19 @@
|
|
|
56
56
|
"globals": "^16.0.0",
|
|
57
57
|
"prettier": "^3.5.3",
|
|
58
58
|
"prettier-plugin-css-order": "^2.1.2",
|
|
59
|
-
"prettier-plugin-curly": "^0.3.
|
|
59
|
+
"prettier-plugin-curly": "^0.3.2",
|
|
60
60
|
"prettier-plugin-packagejson": "^2.5.10",
|
|
61
61
|
"prettier-plugin-sort-json": "^4.1.1",
|
|
62
62
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
63
|
-
"typescript-eslint": "^8.
|
|
63
|
+
"typescript-eslint": "^8.29.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@repo/typescript-config": "workspace:*",
|
|
67
67
|
"@types/bun": "^1.2.8",
|
|
68
|
-
"@types/node": "^22.
|
|
68
|
+
"@types/node": "^22.14.0",
|
|
69
69
|
"commander": "^13.1.0",
|
|
70
70
|
"tsup": "^8.4.0",
|
|
71
|
-
"typescript": "^5.8.
|
|
71
|
+
"typescript": "^5.8.3"
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": "^20.11.0 || >=21.2.0"
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FunctionStyle, EslintConfigObject } from '../types.js';
|
|
2
|
-
import 'eslint';
|
|
3
|
-
import '../constants.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates a base ESLint configuration object with specified function style rules.
|
|
7
|
-
*
|
|
8
|
-
* @param functionStyle - Controls how functions should be written. Can be:
|
|
9
|
-
* - "off": Disables function style enforcement
|
|
10
|
-
* - "arrow": Enforces arrow function expressions
|
|
11
|
-
* - "declaration": Enforces function declarations
|
|
12
|
-
* - "expression": Enforces function expressions
|
|
13
|
-
* @returns ESLint configuration object
|
|
14
|
-
*/
|
|
15
|
-
declare const baseEslintConfig: (functionStyle: "off" | FunctionStyle) => EslintConfigObject;
|
|
16
|
-
|
|
17
|
-
export { baseEslintConfig };
|
|
@@ -1,457 +0,0 @@
|
|
|
1
|
-
// src/eslint/constants.ts
|
|
2
|
-
var configNames = {
|
|
3
|
-
base: "base",
|
|
4
|
-
disableTypeChecked: "typescript-eslint/disable-type-checked",
|
|
5
|
-
ignores: "ignores",
|
|
6
|
-
jsdoc: "jsdoc",
|
|
7
|
-
markdown: "markdown",
|
|
8
|
-
nextjs: "nextjs",
|
|
9
|
-
perfectionist: "perfectionist",
|
|
10
|
-
preferArrowFunction: "prefer-arrow-function",
|
|
11
|
-
react: "react",
|
|
12
|
-
reactCompiler: "react-compiler",
|
|
13
|
-
reactRefresh: "react-refresh",
|
|
14
|
-
storybook: "storybook:stories",
|
|
15
|
-
storybookConfig: "storybook:config",
|
|
16
|
-
testing: "testing",
|
|
17
|
-
turbo: "turbo",
|
|
18
|
-
typescript: "tseslint",
|
|
19
|
-
typescriptTesting: "tseslint-testing",
|
|
20
|
-
unicorn: "unicorn"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// src/eslint/base/rules.ts
|
|
24
|
-
var baseEslintRules = (functionStyle) => ({
|
|
25
|
-
/**
|
|
26
|
-
* Require return statements in array methods callbacks.
|
|
27
|
-
*
|
|
28
|
-
* 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return
|
|
29
|
-
*/
|
|
30
|
-
"array-callback-return": [
|
|
31
|
-
"warn",
|
|
32
|
-
{ allowImplicit: true, checkForEach: true }
|
|
33
|
-
],
|
|
34
|
-
/**
|
|
35
|
-
* Treat `var` statements as if they were block scoped.
|
|
36
|
-
*
|
|
37
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var
|
|
38
|
-
*/
|
|
39
|
-
"block-scoped-var": "warn",
|
|
40
|
-
/**
|
|
41
|
-
* Require camel case names.
|
|
42
|
-
*
|
|
43
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/camelcase
|
|
44
|
-
*/
|
|
45
|
-
camelcase: [
|
|
46
|
-
"warn",
|
|
47
|
-
{
|
|
48
|
-
allow: ["^UNSAFE_"],
|
|
49
|
-
ignoreDestructuring: false,
|
|
50
|
-
ignoreImports: true,
|
|
51
|
-
properties: "never"
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
/**
|
|
55
|
-
* Require curly braces for multiline blocks.
|
|
56
|
-
*
|
|
57
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/curly
|
|
58
|
-
*/
|
|
59
|
-
curly: ["warn", "multi-line"],
|
|
60
|
-
/**
|
|
61
|
-
* Require default clauses in switch statements to be last (if used).
|
|
62
|
-
*
|
|
63
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last
|
|
64
|
-
*/
|
|
65
|
-
"default-case-last": "warn",
|
|
66
|
-
/**
|
|
67
|
-
* Require triple equals (`===` and `!==`).
|
|
68
|
-
*å
|
|
69
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq
|
|
70
|
-
*/
|
|
71
|
-
eqeqeq: "warn",
|
|
72
|
-
"for-direction": "warn",
|
|
73
|
-
/**
|
|
74
|
-
* Require function expressions to have a name.
|
|
75
|
-
*
|
|
76
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/func-names
|
|
77
|
-
*/
|
|
78
|
-
"func-names": ["warn", "as-needed"],
|
|
79
|
-
"func-style": (
|
|
80
|
-
// if arrow function, we use the prefer-arrow-functions plugin
|
|
81
|
-
functionStyle === "off" || functionStyle === "arrow" ? "off" : ["warn", functionStyle, { allowArrowFunctions: true }]
|
|
82
|
-
),
|
|
83
|
-
/**
|
|
84
|
-
* Require grouped accessor pairs in object literals and classes.
|
|
85
|
-
*
|
|
86
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
87
|
-
*/
|
|
88
|
-
"grouped-accessor-pairs": "warn",
|
|
89
|
-
/**
|
|
90
|
-
* Require a capital letter for constructors.
|
|
91
|
-
*
|
|
92
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/new-cap
|
|
93
|
-
*/
|
|
94
|
-
"new-cap": ["warn", { capIsNew: false }],
|
|
95
|
-
/**
|
|
96
|
-
* Disallow use of `alert()`.
|
|
97
|
-
*
|
|
98
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-alert
|
|
99
|
-
*/
|
|
100
|
-
"no-alert": "warn",
|
|
101
|
-
"no-async-promise-executor": "warn",
|
|
102
|
-
/**
|
|
103
|
-
* Disallow use of bitwise operators.
|
|
104
|
-
*
|
|
105
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-bitwise
|
|
106
|
-
*/
|
|
107
|
-
"no-bitwise": "warn",
|
|
108
|
-
/**
|
|
109
|
-
* Disallow use of `caller`/`callee`.
|
|
110
|
-
*
|
|
111
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-caller
|
|
112
|
-
*/
|
|
113
|
-
"no-caller": "warn",
|
|
114
|
-
"no-case-declarations": "warn",
|
|
115
|
-
"no-compare-neg-zero": "warn",
|
|
116
|
-
"no-cond-assign": "warn",
|
|
117
|
-
/**
|
|
118
|
-
* Disallow the use of console.
|
|
119
|
-
*
|
|
120
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-console
|
|
121
|
-
*/
|
|
122
|
-
"no-console": ["warn", { allow: ["info", "warn", "error"] }],
|
|
123
|
-
/**
|
|
124
|
-
* Disallow expressions where the operation doesn't affect the value.
|
|
125
|
-
*
|
|
126
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-console
|
|
127
|
-
*/
|
|
128
|
-
"no-constant-binary-expression": "warn",
|
|
129
|
-
"no-constant-condition": "warn",
|
|
130
|
-
/**
|
|
131
|
-
* Disallow returning value in constructor.
|
|
132
|
-
*
|
|
133
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return
|
|
134
|
-
*/
|
|
135
|
-
"no-constructor-return": "warn",
|
|
136
|
-
"no-control-regex": "warn",
|
|
137
|
-
"no-debugger": "warn",
|
|
138
|
-
"no-delete-var": "warn",
|
|
139
|
-
"no-dupe-else-if": "warn",
|
|
140
|
-
"no-duplicate-case": "warn",
|
|
141
|
-
/**
|
|
142
|
-
* Disallow using an `else` if the `if` block contains a return.
|
|
143
|
-
*
|
|
144
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-else-return
|
|
145
|
-
*/
|
|
146
|
-
"no-else-return": "warn",
|
|
147
|
-
"no-empty": "warn",
|
|
148
|
-
"no-empty-character-class": "warn",
|
|
149
|
-
"no-empty-pattern": "warn",
|
|
150
|
-
"no-empty-static-block": "warn",
|
|
151
|
-
/**
|
|
152
|
-
* Disallow `eval()`.
|
|
153
|
-
*
|
|
154
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-eval
|
|
155
|
-
*/
|
|
156
|
-
"no-eval": "warn",
|
|
157
|
-
"no-ex-assign": "warn",
|
|
158
|
-
/**
|
|
159
|
-
* Disallow extending native objects.
|
|
160
|
-
*
|
|
161
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native
|
|
162
|
-
*/
|
|
163
|
-
"no-extend-native": "warn",
|
|
164
|
-
/**
|
|
165
|
-
* Disallow unnecessary function binding.
|
|
166
|
-
*
|
|
167
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind
|
|
168
|
-
*/
|
|
169
|
-
"no-extra-bind": "warn",
|
|
170
|
-
"no-extra-boolean-cast": "warn",
|
|
171
|
-
/**
|
|
172
|
-
* Disallow unnecessary labels.
|
|
173
|
-
*
|
|
174
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label
|
|
175
|
-
*/
|
|
176
|
-
"no-extra-label": "warn",
|
|
177
|
-
"no-fallthrough": "warn",
|
|
178
|
-
"no-global-assign": "warn",
|
|
179
|
-
/**
|
|
180
|
-
* Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.
|
|
181
|
-
*
|
|
182
|
-
* 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion
|
|
183
|
-
*/
|
|
184
|
-
"no-implicit-coercion": "warn",
|
|
185
|
-
"no-invalid-regexp": "warn",
|
|
186
|
-
"no-irregular-whitespace": "warn",
|
|
187
|
-
/**
|
|
188
|
-
* Disallow usage of `__iterator__` property.
|
|
189
|
-
*
|
|
190
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator
|
|
191
|
-
*/
|
|
192
|
-
"no-iterator": "warn",
|
|
193
|
-
/**
|
|
194
|
-
* Disallow labels that share a name with a variable.
|
|
195
|
-
*
|
|
196
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-label-var
|
|
197
|
-
*/
|
|
198
|
-
"no-label-var": "warn",
|
|
199
|
-
/**
|
|
200
|
-
* Disallow use of labels for anything other than loops and switches.
|
|
201
|
-
*
|
|
202
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-labels
|
|
203
|
-
*/
|
|
204
|
-
"no-labels": ["warn"],
|
|
205
|
-
/**
|
|
206
|
-
* Disallow unnecessary nested blocks.
|
|
207
|
-
*
|
|
208
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks
|
|
209
|
-
*/
|
|
210
|
-
"no-lone-blocks": "warn",
|
|
211
|
-
/**
|
|
212
|
-
* Disallow if as the only statement in an else block.
|
|
213
|
-
*
|
|
214
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-lonely-if
|
|
215
|
-
*/
|
|
216
|
-
"no-lonely-if": "warn",
|
|
217
|
-
"no-loss-of-precision": "warn",
|
|
218
|
-
"no-misleading-character-class": "warn",
|
|
219
|
-
/**
|
|
220
|
-
* Disallow use of chained assignment expressions.
|
|
221
|
-
*
|
|
222
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-multi-assign
|
|
223
|
-
*/
|
|
224
|
-
"no-multi-assign": ["warn"],
|
|
225
|
-
/**
|
|
226
|
-
* Disallow `new` for side effects.
|
|
227
|
-
*
|
|
228
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new
|
|
229
|
-
*/
|
|
230
|
-
"no-new": "warn",
|
|
231
|
-
/**
|
|
232
|
-
* Disallow function constructors.
|
|
233
|
-
*
|
|
234
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func
|
|
235
|
-
*/
|
|
236
|
-
"no-new-func": "warn",
|
|
237
|
-
/**
|
|
238
|
-
* Disallow primitive wrapper instances, such as `new String('foo')`.
|
|
239
|
-
*
|
|
240
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers
|
|
241
|
-
*/
|
|
242
|
-
"no-new-wrappers": "warn",
|
|
243
|
-
"no-nonoctal-decimal-escape": "warn",
|
|
244
|
-
"no-octal": "warn",
|
|
245
|
-
/**
|
|
246
|
-
* Disallow use of octal escape sequences in string literals.
|
|
247
|
-
*
|
|
248
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape
|
|
249
|
-
*/
|
|
250
|
-
"no-octal-escape": "warn",
|
|
251
|
-
/**
|
|
252
|
-
* Disallow reassignment of function parameters.
|
|
253
|
-
*
|
|
254
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign
|
|
255
|
-
*/
|
|
256
|
-
"no-param-reassign": "warn",
|
|
257
|
-
/**
|
|
258
|
-
* Disallow returning values from Promise executor functions.
|
|
259
|
-
*
|
|
260
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-promise-executor-return
|
|
261
|
-
*/
|
|
262
|
-
"no-promise-executor-return": "warn",
|
|
263
|
-
/**
|
|
264
|
-
* Disallow usage of the deprecated `__proto__` property.
|
|
265
|
-
*
|
|
266
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-proto
|
|
267
|
-
*/
|
|
268
|
-
"no-proto": "warn",
|
|
269
|
-
"no-prototype-builtins": "warn",
|
|
270
|
-
"no-regex-spaces": "warn",
|
|
271
|
-
/**
|
|
272
|
-
* Disallow assignment in `return` statement.
|
|
273
|
-
*
|
|
274
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign
|
|
275
|
-
*/
|
|
276
|
-
"no-return-assign": "warn",
|
|
277
|
-
/**
|
|
278
|
-
* Disallow use of `javascript:` urls.
|
|
279
|
-
*
|
|
280
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url
|
|
281
|
-
*/
|
|
282
|
-
"no-script-url": "warn",
|
|
283
|
-
"no-self-assign": "warn",
|
|
284
|
-
/**
|
|
285
|
-
* Disallow comparisons where both sides are exactly the same.
|
|
286
|
-
*
|
|
287
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare
|
|
288
|
-
*/
|
|
289
|
-
"no-self-compare": "warn",
|
|
290
|
-
/**
|
|
291
|
-
* Disallow use of comma operator.
|
|
292
|
-
*
|
|
293
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences
|
|
294
|
-
*/
|
|
295
|
-
"no-sequences": "warn",
|
|
296
|
-
"no-shadow-restricted-names": "warn",
|
|
297
|
-
"no-sparse-arrays": "warn",
|
|
298
|
-
/**
|
|
299
|
-
* Disallow template literal placeholder syntax in regular strings, as
|
|
300
|
-
* these are likely errors.
|
|
301
|
-
*
|
|
302
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-template-curly-in-string
|
|
303
|
-
*/
|
|
304
|
-
"no-template-curly-in-string": "warn",
|
|
305
|
-
/**
|
|
306
|
-
* Disallow initializing variables to `undefined`.
|
|
307
|
-
*
|
|
308
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-undef-init
|
|
309
|
-
*/
|
|
310
|
-
"no-undef-init": "warn",
|
|
311
|
-
"no-unexpected-multiline": "warn",
|
|
312
|
-
/**
|
|
313
|
-
* Disallow ternary operators when simpler alternatives exist.
|
|
314
|
-
*
|
|
315
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-unneeded-ternary
|
|
316
|
-
*/
|
|
317
|
-
"no-unneeded-ternary": "warn",
|
|
318
|
-
/**
|
|
319
|
-
* Disallow loops with a body that allows only one iteration.
|
|
320
|
-
*
|
|
321
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-unreachable-loop
|
|
322
|
-
*/
|
|
323
|
-
"no-unreachable-loop": "warn",
|
|
324
|
-
"no-unsafe-finally": "warn",
|
|
325
|
-
"no-unsafe-optional-chaining": "warn",
|
|
326
|
-
"no-unused-labels": "warn",
|
|
327
|
-
"no-unused-private-class-members": "warn",
|
|
328
|
-
"no-useless-backreference": "warn",
|
|
329
|
-
/**
|
|
330
|
-
* Disallow unnecessary `.call()` and `.apply()`.
|
|
331
|
-
*
|
|
332
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call
|
|
333
|
-
*/
|
|
334
|
-
"no-useless-call": "warn",
|
|
335
|
-
"no-useless-catch": "warn",
|
|
336
|
-
/**
|
|
337
|
-
* Disallow useless computed property keys.
|
|
338
|
-
*
|
|
339
|
-
* � Fixable - https://eslint.org/docs/rules/no-useless-computed-key
|
|
340
|
-
*/
|
|
341
|
-
"no-useless-computed-key": "warn",
|
|
342
|
-
/**
|
|
343
|
-
* Disallow unnecessary concatenation of strings.
|
|
344
|
-
*
|
|
345
|
-
* � Not fixable - https://eslint.org/docs/rules/no-useless-concat
|
|
346
|
-
*/
|
|
347
|
-
"no-useless-concat": "warn",
|
|
348
|
-
"no-useless-escape": "warn",
|
|
349
|
-
/**
|
|
350
|
-
* Disallow renaming import, export, and destructured assignments to the
|
|
351
|
-
* same name.
|
|
352
|
-
*
|
|
353
|
-
* � Fixable - https://eslint.org/docs/rules/no-useless-rename
|
|
354
|
-
*/
|
|
355
|
-
"no-useless-rename": "warn",
|
|
356
|
-
/**
|
|
357
|
-
* Disallow redundant return statements.
|
|
358
|
-
*
|
|
359
|
-
* � Fixable - https://eslint.org/docs/rules/no-useless-return
|
|
360
|
-
*/
|
|
361
|
-
"no-useless-return": "warn",
|
|
362
|
-
/**
|
|
363
|
-
* Require `let` or `const` instead of `var`.
|
|
364
|
-
* ts transpiles let/const to var, so no need for vars any more
|
|
365
|
-
*
|
|
366
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-var
|
|
367
|
-
*/
|
|
368
|
-
"no-var": "warn",
|
|
369
|
-
"no-with": "warn",
|
|
370
|
-
/**
|
|
371
|
-
* Require object literal shorthand syntax.
|
|
372
|
-
*
|
|
373
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/object-shorthand
|
|
374
|
-
*/
|
|
375
|
-
"object-shorthand": "warn",
|
|
376
|
-
/**
|
|
377
|
-
* Require default to `const` instead of `let`.
|
|
378
|
-
* ts provides better types with const
|
|
379
|
-
*
|
|
380
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-const
|
|
381
|
-
*/
|
|
382
|
-
"prefer-const": "warn",
|
|
383
|
-
/**
|
|
384
|
-
* Require using named capture groups in regular expressions.
|
|
385
|
-
*
|
|
386
|
-
* � Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group
|
|
387
|
-
*/
|
|
388
|
-
"prefer-named-capture-group": "warn",
|
|
389
|
-
/**
|
|
390
|
-
* Disallow parseInt() in favor of binary, octal, and hexadecimal literals.
|
|
391
|
-
*
|
|
392
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-numeric-literals
|
|
393
|
-
*/
|
|
394
|
-
"prefer-numeric-literals": "warn",
|
|
395
|
-
/**
|
|
396
|
-
* Require use of an object spread over Object.assign.
|
|
397
|
-
*
|
|
398
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-object-spread
|
|
399
|
-
*/
|
|
400
|
-
"prefer-object-spread": "warn",
|
|
401
|
-
/**
|
|
402
|
-
* Disallow use of the RegExp constructor in favor of regular expression
|
|
403
|
-
* literals.
|
|
404
|
-
*
|
|
405
|
-
* � Not fixable - https://eslint.org/docs/rules/prefer-regex-literals
|
|
406
|
-
*/
|
|
407
|
-
"prefer-regex-literals": "warn",
|
|
408
|
-
/**
|
|
409
|
-
* Require using rest parameters instead of `arguments`.
|
|
410
|
-
* ts provides better types with rest args over arguments
|
|
411
|
-
*
|
|
412
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-rest-params
|
|
413
|
-
*/
|
|
414
|
-
"prefer-rest-params": "warn",
|
|
415
|
-
/**
|
|
416
|
-
* Require using spread syntax instead of `.apply()`.
|
|
417
|
-
* ts transpiles spread to apply, so no need for manual apply
|
|
418
|
-
*
|
|
419
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-spread
|
|
420
|
-
*/
|
|
421
|
-
"prefer-spread": "warn",
|
|
422
|
-
/**
|
|
423
|
-
* Require using template literals instead of string concatenation.
|
|
424
|
-
*
|
|
425
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/prefer-template
|
|
426
|
-
*/
|
|
427
|
-
"prefer-template": "warn",
|
|
428
|
-
"require-yield": "warn",
|
|
429
|
-
/**
|
|
430
|
-
* Require a `Symbol` description.
|
|
431
|
-
*
|
|
432
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/symbol-description
|
|
433
|
-
*/
|
|
434
|
-
"symbol-description": "warn",
|
|
435
|
-
"use-isnan": "warn",
|
|
436
|
-
"valid-typeof": "warn",
|
|
437
|
-
/**
|
|
438
|
-
* Disallow "Yoda conditions", ensuring the comparison.
|
|
439
|
-
*
|
|
440
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/yoda
|
|
441
|
-
*/
|
|
442
|
-
yoda: "warn"
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
// src/eslint/base/config.ts
|
|
446
|
-
var baseEslintConfig = (functionStyle) => ({
|
|
447
|
-
languageOptions: {
|
|
448
|
-
ecmaVersion: 2022
|
|
449
|
-
},
|
|
450
|
-
linterOptions: { reportUnusedDisableDirectives: true },
|
|
451
|
-
name: configNames.base,
|
|
452
|
-
rules: baseEslintRules(functionStyle)
|
|
453
|
-
});
|
|
454
|
-
export {
|
|
455
|
-
baseEslintConfig
|
|
456
|
-
};
|
|
457
|
-
//# sourceMappingURL=config.js.map
|