@haltcase/style 8.0.0 → 8.0.1-canary.1
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/.editorconfig +15 -0
- package/dist/editorconfig/index.d.ts +6 -0
- package/dist/editorconfig/index.js +8 -0
- package/dist/oxfmt/index.d.ts +8 -0
- package/dist/oxfmt/index.js +57 -0
- package/dist/oxlint/configs/base.d.ts +190 -0
- package/dist/oxlint/configs/base.js +39 -0
- package/dist/oxlint/configs/next.d.ts +25 -0
- package/dist/oxlint/configs/next.js +38 -0
- package/dist/oxlint/configs/node.d.ts +16 -0
- package/dist/oxlint/configs/node.js +11 -0
- package/dist/oxlint/configs/react.d.ts +7 -0
- package/dist/oxlint/configs/react.js +27 -0
- package/dist/oxlint/configs/tanstack-router.d.ts +22 -0
- package/dist/oxlint/configs/tanstack-router.js +22 -0
- package/dist/oxlint/configs/tanstack-start.d.ts +23 -0
- package/dist/oxlint/configs/tanstack-start.js +22 -0
- package/dist/oxlint/configs/testing.d.ts +16 -0
- package/dist/oxlint/configs/testing.js +11 -0
- package/dist/oxlint/configs/typescript.d.ts +77 -0
- package/dist/oxlint/configs/typescript.js +18 -0
- package/dist/oxlint/constants.d.ts +26 -0
- package/dist/oxlint/constants.js +37 -0
- package/dist/oxlint/index.d.ts +34 -0
- package/dist/oxlint/index.js +51 -0
- package/dist/oxlint/rules/best-practice.d.ts +181 -0
- package/dist/oxlint/rules/best-practice.js +177 -0
- package/dist/oxlint/rules/imports.d.ts +67 -0
- package/dist/oxlint/rules/imports.js +67 -0
- package/dist/oxlint/rules/jsx-a11y.d.ts +8 -0
- package/dist/oxlint/rules/jsx-a11y.js +6 -0
- package/dist/oxlint/rules/playwright-test.d.ts +25 -0
- package/dist/oxlint/rules/playwright-test.js +26 -0
- package/dist/oxlint/rules/possible-errors.d.ts +28 -0
- package/dist/oxlint/rules/possible-errors.js +29 -0
- package/dist/oxlint/rules/react-x.d.ts +38 -0
- package/dist/oxlint/rules/react-x.js +38 -0
- package/dist/oxlint/rules/react.d.ts +28 -0
- package/dist/oxlint/rules/react.js +20 -0
- package/dist/oxlint/rules/restriction.d.ts +22 -0
- package/dist/oxlint/rules/restriction.js +22 -0
- package/dist/oxlint/rules/stylistic-jsx.d.ts +15 -0
- package/dist/oxlint/rules/stylistic-jsx.js +15 -0
- package/dist/oxlint/rules/stylistic.d.ts +88 -0
- package/dist/oxlint/rules/stylistic.js +74 -0
- package/dist/oxlint/rules/typescript/declaration-files.d.ts +8 -0
- package/dist/oxlint/rules/typescript/declaration-files.js +6 -0
- package/dist/oxlint/rules/typescript/index.d.ts +107 -0
- package/dist/oxlint/rules/typescript/index.js +103 -0
- package/dist/oxlint/rules/variables.d.ts +25 -0
- package/dist/oxlint/rules/variables.js +26 -0
- package/dist/oxlint/utils/eslint-compat.d.ts +9 -0
- package/dist/oxlint/utils/eslint-compat.js +35 -0
- package/dist/stylelint/_base.d.ts +6 -0
- package/dist/stylelint/_base.js +40 -0
- package/dist/stylelint/index.d.ts +6 -0
- package/dist/stylelint/index.js +18 -0
- package/dist/stylelint/modules.d.ts +6 -0
- package/dist/stylelint/modules.js +19 -0
- package/dist/stylelint/standard.d.ts +4 -0
- package/dist/stylelint/standard.js +5 -0
- package/dist/stylelint/tailwind.d.ts +6 -0
- package/dist/stylelint/tailwind.js +11 -0
- package/dist/typescript/tsconfig.base.json +14 -0
- package/dist/typescript/tsconfig.bundler.json +17 -0
- package/dist/typescript/tsconfig.next.json +36 -0
- package/dist/typescript/tsconfig.node-ts.json +10 -0
- package/dist/typescript/tsconfig.node.json +4 -0
- package/dist/typescript/tsconfig.node22.json +12 -0
- package/dist/typescript/tsconfig.node24.json +12 -0
- package/dist/typescript/tsconfig.node26.json +11 -0
- package/dist/typescript/tsconfig.web.json +8 -0
- package/dist/vite-plus/index.d.ts +11 -0
- package/dist/vite-plus/index.js +16 -0
- package/package.json +2 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { sharedCategoryConfig } from "../constants.js";
|
|
5
|
+
import { typescriptDeclarationFilesRules } from "../rules/typescript/declaration-files.js";
|
|
6
|
+
import { typescriptBaseRules } from "../rules/typescript/index.js";
|
|
7
|
+
//#region src/oxlint/configs/typescript.ts
|
|
8
|
+
const typescriptConfig = [{
|
|
9
|
+
plugins: ["typescript", "unicorn"],
|
|
10
|
+
categories: { ...sharedCategoryConfig },
|
|
11
|
+
rules: { ...typescriptBaseRules },
|
|
12
|
+
overrides: [{
|
|
13
|
+
files: ["*.d.ts"],
|
|
14
|
+
rules: { ...typescriptDeclarationFilesRules }
|
|
15
|
+
}]
|
|
16
|
+
}];
|
|
17
|
+
//#endregion
|
|
18
|
+
export { typescriptConfig };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/oxlint/constants.d.ts
|
|
4
|
+
declare const commonJsOnlyFiles: string[];
|
|
5
|
+
declare const commonJsFiles: string[];
|
|
6
|
+
declare const javascriptFiles: string[];
|
|
7
|
+
declare const typescriptFiles: string[];
|
|
8
|
+
declare const javascriptJsxFiles: string[];
|
|
9
|
+
declare const typescriptJsxFiles: string[];
|
|
10
|
+
declare const jsxFiles: string[];
|
|
11
|
+
declare const configFiles: string[];
|
|
12
|
+
declare const scriptFiles: string[];
|
|
13
|
+
declare const nextJsPageFiles: string[];
|
|
14
|
+
declare const nextJsApiRouteFiles: string[];
|
|
15
|
+
declare const nextJsMetadataFiles: string[];
|
|
16
|
+
declare const allSupportedFiles: string[];
|
|
17
|
+
declare const sharedCategoryConfig: {
|
|
18
|
+
correctness: "error";
|
|
19
|
+
suspicious: "error";
|
|
20
|
+
pedantic: "error";
|
|
21
|
+
perf: "error";
|
|
22
|
+
restriction: "error";
|
|
23
|
+
style: "error";
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { allSupportedFiles, commonJsFiles, commonJsOnlyFiles, configFiles, javascriptFiles, javascriptJsxFiles, jsxFiles, nextJsApiRouteFiles, nextJsMetadataFiles, nextJsPageFiles, scriptFiles, sharedCategoryConfig, typescriptFiles, typescriptJsxFiles };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/oxlint/constants.ts
|
|
5
|
+
const commonJsOnlyFiles = ["**/*.cjs"];
|
|
6
|
+
const commonJsFiles = ["**/*.{c,}js"];
|
|
7
|
+
const javascriptFiles = ["**/*.{m,}js{x,}"];
|
|
8
|
+
const typescriptFiles = ["**/*.{m,}ts{x,}"];
|
|
9
|
+
const javascriptJsxFiles = ["**/*.{m,}jsx"];
|
|
10
|
+
const typescriptJsxFiles = ["**/*.{m,}tsx"];
|
|
11
|
+
const jsxFiles = ["**/*.{c,m,}{js,ts}x"];
|
|
12
|
+
const configFiles = ["**/*.config.{m,}{js,ts}", ".*rc.{js,ts}"];
|
|
13
|
+
const scriptFiles = [
|
|
14
|
+
"**/scripts/*",
|
|
15
|
+
"**/prisma/*",
|
|
16
|
+
"**/zenstack/*"
|
|
17
|
+
];
|
|
18
|
+
const nextJsPageFiles = ["**/{pages,app}/**/*.{m,}{js,ts}x"];
|
|
19
|
+
const nextJsApiRouteFiles = ["**/pages/api/**/*.{m,}{js,ts}", "**/app/**/route.{m,}{js,ts}x"];
|
|
20
|
+
const nextJsMetadataFiles = [
|
|
21
|
+
"**/app/{apple-,}icon.{js,ts}x",
|
|
22
|
+
"**/app/manifest.{js,ts}",
|
|
23
|
+
"**/app/robots.{js,ts}",
|
|
24
|
+
"**/app/sitemap.{js,ts}",
|
|
25
|
+
"**/app/{opengraph,twitter}-image.{js,ts}x"
|
|
26
|
+
];
|
|
27
|
+
const allSupportedFiles = ["**/*.{c,m,}{js,ts}{x,}"];
|
|
28
|
+
const sharedCategoryConfig = {
|
|
29
|
+
correctness: "error",
|
|
30
|
+
suspicious: "error",
|
|
31
|
+
pedantic: "error",
|
|
32
|
+
perf: "error",
|
|
33
|
+
restriction: "error",
|
|
34
|
+
style: "error"
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { allSupportedFiles, commonJsFiles, commonJsOnlyFiles, configFiles, javascriptFiles, javascriptJsxFiles, jsxFiles, nextJsApiRouteFiles, nextJsMetadataFiles, nextJsPageFiles, scriptFiles, sharedCategoryConfig, typescriptFiles, typescriptJsxFiles };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { OxlintConfig, OxlintOverride } from "oxlint";
|
|
4
|
+
//#region src/oxlint/index.d.ts
|
|
5
|
+
declare const tanstackPackages: readonly ["@tanstack/react-router", "@tanstack/react-start", "@tanstack/eslint-plugin-router"];
|
|
6
|
+
type OxlintPassthroughOptions = Omit<OxlintConfig, "overrides">;
|
|
7
|
+
interface CreateOxlintConfigOptions extends OxlintPassthroughOptions {
|
|
8
|
+
typescript?: boolean;
|
|
9
|
+
react?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Enable rules for TanStack Router projects. This implies `react` and
|
|
12
|
+
* configures React rules as well.
|
|
13
|
+
*/
|
|
14
|
+
tanstackRouter?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Enable rules for TanStack Start projects. This implies `react` and
|
|
17
|
+
* `tanstackRouter` and configures those rules as well.
|
|
18
|
+
*/
|
|
19
|
+
tanstackStart?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Enable rules for Next.js projects. This implies `react` and configures React rules as well.
|
|
22
|
+
*/
|
|
23
|
+
next?: boolean;
|
|
24
|
+
node?: boolean;
|
|
25
|
+
testing?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Add, remove, or otherwise reconfigure rules for specific files or groups of files.
|
|
28
|
+
* These overrides supercede any rules configured by preset options (e.g., `node` or `react`).
|
|
29
|
+
*/
|
|
30
|
+
overrides?: OxlintOverride[];
|
|
31
|
+
}
|
|
32
|
+
declare const createOxlintConfig: (options?: CreateOxlintConfigOptions) => OxlintConfig;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { CreateOxlintConfigOptions, createOxlintConfig, tanstackPackages };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { baseConfig } from "./configs/base.js";
|
|
5
|
+
import { nextConfig } from "./configs/next.js";
|
|
6
|
+
import { nodeConfig } from "./configs/node.js";
|
|
7
|
+
import { reactConfig } from "./configs/react.js";
|
|
8
|
+
import { tanstackRouterConfig } from "./configs/tanstack-router.js";
|
|
9
|
+
import { tanstackStartConfig } from "./configs/tanstack-start.js";
|
|
10
|
+
import { testingConfig } from "./configs/testing.js";
|
|
11
|
+
import { typescriptConfig } from "./configs/typescript.js";
|
|
12
|
+
import { isPackageExists } from "local-pkg";
|
|
13
|
+
//#region src/oxlint/index.ts
|
|
14
|
+
const reactPackages = [
|
|
15
|
+
"react",
|
|
16
|
+
"react-dom",
|
|
17
|
+
"@tanstack/react-router",
|
|
18
|
+
"@tanstack/react-start"
|
|
19
|
+
];
|
|
20
|
+
const tanstackPackages = [
|
|
21
|
+
"@tanstack/react-router",
|
|
22
|
+
"@tanstack/react-start",
|
|
23
|
+
"@tanstack/eslint-plugin-router"
|
|
24
|
+
];
|
|
25
|
+
const typescriptPackages = ["@typescript/native-preview", "typescript"];
|
|
26
|
+
const createOxlintConfig = (options = {}) => {
|
|
27
|
+
const { env, extends: userExtends = [], globals, ignorePatterns: userIgnores = [], options: lintOptions, overrides = [], settings, typescript: isTypescriptEnabled = typescriptPackages.some((pkg) => isPackageExists(pkg)), react: isReactEnabled = reactPackages.some((pkg) => isPackageExists(pkg)), tanstackRouter: isTanstackRouterEnabled = tanstackPackages.filter((pkg) => pkg !== "@tanstack/react-start").every((pkg) => isPackageExists(pkg)), tanstackStart: isTanstackStartEnabled = tanstackPackages.every((pkg) => isPackageExists(pkg)), next: isNextEnabled = isPackageExists("next"), node: isNodeEnabled = false, testing: isTestingEnabled = false } = options;
|
|
28
|
+
const configs = [...userExtends, ...baseConfig];
|
|
29
|
+
if (isTypescriptEnabled) configs.push(...typescriptConfig);
|
|
30
|
+
if (isReactEnabled) configs.push(...reactConfig);
|
|
31
|
+
if (isNodeEnabled) configs.push(...nodeConfig);
|
|
32
|
+
if (isTestingEnabled) configs.push(...testingConfig);
|
|
33
|
+
if (isNextEnabled) configs.push(...nextConfig);
|
|
34
|
+
if (isTanstackRouterEnabled) configs.push(...tanstackRouterConfig);
|
|
35
|
+
if (isTanstackStartEnabled) configs.push(...tanstackStartConfig);
|
|
36
|
+
return {
|
|
37
|
+
env,
|
|
38
|
+
extends: configs,
|
|
39
|
+
globals,
|
|
40
|
+
ignorePatterns: [...userIgnores],
|
|
41
|
+
overrides,
|
|
42
|
+
options: {
|
|
43
|
+
typeAware: isTypescriptEnabled,
|
|
44
|
+
typeCheck: isTypescriptEnabled,
|
|
45
|
+
...lintOptions
|
|
46
|
+
},
|
|
47
|
+
settings
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { createOxlintConfig, tanstackPackages };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/oxlint/rules/best-practice.d.ts
|
|
4
|
+
declare const bestPracticeRules: {
|
|
5
|
+
/**
|
|
6
|
+
* Require return statements in array methods callbacks.
|
|
7
|
+
*/
|
|
8
|
+
"array-callback-return": ["error", {
|
|
9
|
+
allowImplicit: true;
|
|
10
|
+
}];
|
|
11
|
+
/**
|
|
12
|
+
* Treat `var` statements as if they were block scoped.
|
|
13
|
+
*/
|
|
14
|
+
"block-scoped-var": "error";
|
|
15
|
+
/**
|
|
16
|
+
* Require curly braces for multiline blocks.
|
|
17
|
+
*/
|
|
18
|
+
curly: ["error", "multi-line"];
|
|
19
|
+
/**
|
|
20
|
+
* Require default clauses in switch statements to be last (if used).
|
|
21
|
+
*/
|
|
22
|
+
"default-case-last": "error";
|
|
23
|
+
/**
|
|
24
|
+
* Require default parameters to be last.
|
|
25
|
+
*/
|
|
26
|
+
"default-param-last": "error";
|
|
27
|
+
/**
|
|
28
|
+
* Require triple equals (`===` and `!==`).
|
|
29
|
+
*/
|
|
30
|
+
eqeqeq: ["error", "always", {
|
|
31
|
+
null: "ignore";
|
|
32
|
+
}];
|
|
33
|
+
/**
|
|
34
|
+
* Require grouped accessor pairs in object literals and classes.
|
|
35
|
+
*/
|
|
36
|
+
"grouped-accessor-pairs": "error";
|
|
37
|
+
/**
|
|
38
|
+
* Disallow use of `alert()`.
|
|
39
|
+
*/
|
|
40
|
+
"no-alert": "error";
|
|
41
|
+
/**
|
|
42
|
+
* Disallow use of `caller`/`callee`.
|
|
43
|
+
*/
|
|
44
|
+
"no-caller": "error";
|
|
45
|
+
/**
|
|
46
|
+
* Disallow returning value in constructor.
|
|
47
|
+
*/
|
|
48
|
+
"no-constructor-return": "error";
|
|
49
|
+
/**
|
|
50
|
+
* Disallow using an `else` if the `if` block contains a return.
|
|
51
|
+
*/
|
|
52
|
+
"no-else-return": "error";
|
|
53
|
+
/**
|
|
54
|
+
* Disallow `eval()`.
|
|
55
|
+
*/
|
|
56
|
+
"no-eval": "error";
|
|
57
|
+
/**
|
|
58
|
+
* Disallow extending native objects.
|
|
59
|
+
*/
|
|
60
|
+
"no-extend-native": "error";
|
|
61
|
+
/**
|
|
62
|
+
* Disallow unnecessary function binding.
|
|
63
|
+
*/
|
|
64
|
+
"no-extra-bind": "error";
|
|
65
|
+
/**
|
|
66
|
+
* Disallow unnecessary labels.
|
|
67
|
+
*/
|
|
68
|
+
"no-extra-label": "error";
|
|
69
|
+
/**
|
|
70
|
+
* Require converting types explicitly, e.g., `Boolean(foo)` instead of `!!foo`.
|
|
71
|
+
*/
|
|
72
|
+
"no-implicit-coercion": "error";
|
|
73
|
+
/**
|
|
74
|
+
* Disallow use of `eval()`-like methods.
|
|
75
|
+
*
|
|
76
|
+
* https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-implied-eval
|
|
77
|
+
*/
|
|
78
|
+
"no-implied-eval": "error";
|
|
79
|
+
/**
|
|
80
|
+
* Disallow usage of `__iterator__` property.
|
|
81
|
+
*/
|
|
82
|
+
"no-iterator": "error";
|
|
83
|
+
/**
|
|
84
|
+
* Disallow use of labels.
|
|
85
|
+
*/
|
|
86
|
+
"no-labels": "error";
|
|
87
|
+
/**
|
|
88
|
+
* Disallow unnecessary nested blocks.
|
|
89
|
+
*/
|
|
90
|
+
"no-lone-blocks": "error";
|
|
91
|
+
/**
|
|
92
|
+
* Disallow creation of functions within loops.
|
|
93
|
+
*/
|
|
94
|
+
"no-loop-func": "error";
|
|
95
|
+
/**
|
|
96
|
+
* Disallow `new` for side effects.
|
|
97
|
+
*/
|
|
98
|
+
"no-new": "error";
|
|
99
|
+
/**
|
|
100
|
+
* Disallow function constructors.
|
|
101
|
+
*/
|
|
102
|
+
"no-new-func": "error";
|
|
103
|
+
/**
|
|
104
|
+
* Disallow primitive wrapper instances, such as `new String('foo')`.
|
|
105
|
+
*/
|
|
106
|
+
"no-new-wrappers": "error";
|
|
107
|
+
/**
|
|
108
|
+
* Disallow reassignment of function parameters.
|
|
109
|
+
*/
|
|
110
|
+
"no-param-reassign": "error";
|
|
111
|
+
/**
|
|
112
|
+
* Disallow usage of the deprecated `__proto__` property.
|
|
113
|
+
*/
|
|
114
|
+
"no-proto": "error";
|
|
115
|
+
/**
|
|
116
|
+
* Disallow assignment in `return` statement.
|
|
117
|
+
*/
|
|
118
|
+
"no-return-assign": "error";
|
|
119
|
+
/**
|
|
120
|
+
* Disallow use of `javascript:` urls.
|
|
121
|
+
*/
|
|
122
|
+
"no-script-url": "error";
|
|
123
|
+
/**
|
|
124
|
+
* Disallow comparisons where both sides are exactly the same.
|
|
125
|
+
*/
|
|
126
|
+
"no-self-compare": "error";
|
|
127
|
+
/**
|
|
128
|
+
* Disallow use of comma operator.
|
|
129
|
+
*/
|
|
130
|
+
"no-sequences": "error";
|
|
131
|
+
/**
|
|
132
|
+
* Disallow variable declarations from shadowing variables declared in the
|
|
133
|
+
* outer scope.
|
|
134
|
+
*/
|
|
135
|
+
"no-shadow": "error";
|
|
136
|
+
/**
|
|
137
|
+
* Disallow unnecessary `.call()` and `.apply()`.
|
|
138
|
+
*/
|
|
139
|
+
"no-useless-call": "error";
|
|
140
|
+
/**
|
|
141
|
+
* Disallow unnecessary concatenation of strings.
|
|
142
|
+
*/
|
|
143
|
+
"no-useless-concat": "error";
|
|
144
|
+
/**
|
|
145
|
+
* Disallow unnecessary constructors.
|
|
146
|
+
*/
|
|
147
|
+
"no-useless-constructor": "error";
|
|
148
|
+
/**
|
|
149
|
+
* Disallow redundant return statements.
|
|
150
|
+
*/
|
|
151
|
+
"no-useless-return": "error";
|
|
152
|
+
"node/no-sync": ["error", {
|
|
153
|
+
ignores: string[];
|
|
154
|
+
}];
|
|
155
|
+
/**
|
|
156
|
+
* Require using named capture groups in regular expressions.
|
|
157
|
+
*/
|
|
158
|
+
"prefer-named-capture-group": "error";
|
|
159
|
+
/**
|
|
160
|
+
* Require using Error objects as Promise rejection reasons.
|
|
161
|
+
*/
|
|
162
|
+
"prefer-promise-reject-errors": ["error", {
|
|
163
|
+
allowEmptyReject: true;
|
|
164
|
+
}];
|
|
165
|
+
/**
|
|
166
|
+
* Disallow use of the RegExp constructor in favor of regular expression
|
|
167
|
+
* literals.
|
|
168
|
+
*/
|
|
169
|
+
"prefer-regex-literals": "error";
|
|
170
|
+
/**
|
|
171
|
+
* Disallow the `"use strict"` directive (we assume ESM by default).
|
|
172
|
+
* NOT IMPLEMENTED YET - https://github.com/oxc-project/oxc/issues/479
|
|
173
|
+
*/
|
|
174
|
+
/**
|
|
175
|
+
* Disallow "Yoda conditions".
|
|
176
|
+
*/
|
|
177
|
+
yoda: "error";
|
|
178
|
+
"require-unicode-regexp": "off";
|
|
179
|
+
};
|
|
180
|
+
//#endregion
|
|
181
|
+
export { bestPracticeRules };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
const bestPracticeRules = {
|
|
5
|
+
"require-unicode-regexp": "off",
|
|
6
|
+
/**
|
|
7
|
+
* Require return statements in array methods callbacks.
|
|
8
|
+
*/
|
|
9
|
+
"array-callback-return": ["error", { allowImplicit: true }],
|
|
10
|
+
/**
|
|
11
|
+
* Treat `var` statements as if they were block scoped.
|
|
12
|
+
*/
|
|
13
|
+
"block-scoped-var": "error",
|
|
14
|
+
/**
|
|
15
|
+
* Require curly braces for multiline blocks.
|
|
16
|
+
*/
|
|
17
|
+
curly: ["error", "multi-line"],
|
|
18
|
+
/**
|
|
19
|
+
* Require default clauses in switch statements to be last (if used).
|
|
20
|
+
*/
|
|
21
|
+
"default-case-last": "error",
|
|
22
|
+
/**
|
|
23
|
+
* Require default parameters to be last.
|
|
24
|
+
*/
|
|
25
|
+
"default-param-last": "error",
|
|
26
|
+
/**
|
|
27
|
+
* Require triple equals (`===` and `!==`).
|
|
28
|
+
*/
|
|
29
|
+
eqeqeq: [
|
|
30
|
+
"error",
|
|
31
|
+
"always",
|
|
32
|
+
{ null: "ignore" }
|
|
33
|
+
],
|
|
34
|
+
/**
|
|
35
|
+
* Require grouped accessor pairs in object literals and classes.
|
|
36
|
+
*/
|
|
37
|
+
"grouped-accessor-pairs": "error",
|
|
38
|
+
/**
|
|
39
|
+
* Disallow use of `alert()`.
|
|
40
|
+
*/
|
|
41
|
+
"no-alert": "error",
|
|
42
|
+
/**
|
|
43
|
+
* Disallow use of `caller`/`callee`.
|
|
44
|
+
*/
|
|
45
|
+
"no-caller": "error",
|
|
46
|
+
/**
|
|
47
|
+
* Disallow returning value in constructor.
|
|
48
|
+
*/
|
|
49
|
+
"no-constructor-return": "error",
|
|
50
|
+
/**
|
|
51
|
+
* Disallow using an `else` if the `if` block contains a return.
|
|
52
|
+
*/
|
|
53
|
+
"no-else-return": "error",
|
|
54
|
+
/**
|
|
55
|
+
* Disallow `eval()`.
|
|
56
|
+
*/
|
|
57
|
+
"no-eval": "error",
|
|
58
|
+
/**
|
|
59
|
+
* Disallow extending native objects.
|
|
60
|
+
*/
|
|
61
|
+
"no-extend-native": "error",
|
|
62
|
+
/**
|
|
63
|
+
* Disallow unnecessary function binding.
|
|
64
|
+
*/
|
|
65
|
+
"no-extra-bind": "error",
|
|
66
|
+
/**
|
|
67
|
+
* Disallow unnecessary labels.
|
|
68
|
+
*/
|
|
69
|
+
"no-extra-label": "error",
|
|
70
|
+
/**
|
|
71
|
+
* Require converting types explicitly, e.g., `Boolean(foo)` instead of `!!foo`.
|
|
72
|
+
*/
|
|
73
|
+
"no-implicit-coercion": "error",
|
|
74
|
+
/**
|
|
75
|
+
* Disallow use of `eval()`-like methods.
|
|
76
|
+
*
|
|
77
|
+
* https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-implied-eval
|
|
78
|
+
*/
|
|
79
|
+
"no-implied-eval": "error",
|
|
80
|
+
/**
|
|
81
|
+
* Disallow usage of `__iterator__` property.
|
|
82
|
+
*/
|
|
83
|
+
"no-iterator": "error",
|
|
84
|
+
/**
|
|
85
|
+
* Disallow use of labels.
|
|
86
|
+
*/
|
|
87
|
+
"no-labels": "error",
|
|
88
|
+
/**
|
|
89
|
+
* Disallow unnecessary nested blocks.
|
|
90
|
+
*/
|
|
91
|
+
"no-lone-blocks": "error",
|
|
92
|
+
/**
|
|
93
|
+
* Disallow creation of functions within loops.
|
|
94
|
+
*/
|
|
95
|
+
"no-loop-func": "error",
|
|
96
|
+
/**
|
|
97
|
+
* Disallow `new` for side effects.
|
|
98
|
+
*/
|
|
99
|
+
"no-new": "error",
|
|
100
|
+
/**
|
|
101
|
+
* Disallow function constructors.
|
|
102
|
+
*/
|
|
103
|
+
"no-new-func": "error",
|
|
104
|
+
/**
|
|
105
|
+
* Disallow primitive wrapper instances, such as `new String('foo')`.
|
|
106
|
+
*/
|
|
107
|
+
"no-new-wrappers": "error",
|
|
108
|
+
/**
|
|
109
|
+
* Disallow reassignment of function parameters.
|
|
110
|
+
*/
|
|
111
|
+
"no-param-reassign": "error",
|
|
112
|
+
/**
|
|
113
|
+
* Disallow usage of the deprecated `__proto__` property.
|
|
114
|
+
*/
|
|
115
|
+
"no-proto": "error",
|
|
116
|
+
/**
|
|
117
|
+
* Disallow assignment in `return` statement.
|
|
118
|
+
*/
|
|
119
|
+
"no-return-assign": "error",
|
|
120
|
+
/**
|
|
121
|
+
* Disallow use of `javascript:` urls.
|
|
122
|
+
*/
|
|
123
|
+
"no-script-url": "error",
|
|
124
|
+
/**
|
|
125
|
+
* Disallow comparisons where both sides are exactly the same.
|
|
126
|
+
*/
|
|
127
|
+
"no-self-compare": "error",
|
|
128
|
+
/**
|
|
129
|
+
* Disallow use of comma operator.
|
|
130
|
+
*/
|
|
131
|
+
"no-sequences": "error",
|
|
132
|
+
/**
|
|
133
|
+
* Disallow variable declarations from shadowing variables declared in the
|
|
134
|
+
* outer scope.
|
|
135
|
+
*/
|
|
136
|
+
"no-shadow": "error",
|
|
137
|
+
/**
|
|
138
|
+
* Disallow unnecessary `.call()` and `.apply()`.
|
|
139
|
+
*/
|
|
140
|
+
"no-useless-call": "error",
|
|
141
|
+
/**
|
|
142
|
+
* Disallow unnecessary concatenation of strings.
|
|
143
|
+
*/
|
|
144
|
+
"no-useless-concat": "error",
|
|
145
|
+
/**
|
|
146
|
+
* Disallow unnecessary constructors.
|
|
147
|
+
*/
|
|
148
|
+
"no-useless-constructor": "error",
|
|
149
|
+
/**
|
|
150
|
+
* Disallow redundant return statements.
|
|
151
|
+
*/
|
|
152
|
+
"no-useless-return": "error",
|
|
153
|
+
"node/no-sync": ["error", { ignores: ["existsSync"] }],
|
|
154
|
+
/**
|
|
155
|
+
* Require using named capture groups in regular expressions.
|
|
156
|
+
*/
|
|
157
|
+
"prefer-named-capture-group": "error",
|
|
158
|
+
/**
|
|
159
|
+
* Require using Error objects as Promise rejection reasons.
|
|
160
|
+
*/
|
|
161
|
+
"prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
|
|
162
|
+
/**
|
|
163
|
+
* Disallow use of the RegExp constructor in favor of regular expression
|
|
164
|
+
* literals.
|
|
165
|
+
*/
|
|
166
|
+
"prefer-regex-literals": "error",
|
|
167
|
+
/**
|
|
168
|
+
* Disallow the `"use strict"` directive (we assume ESM by default).
|
|
169
|
+
* NOT IMPLEMENTED YET - https://github.com/oxc-project/oxc/issues/479
|
|
170
|
+
*/
|
|
171
|
+
/**
|
|
172
|
+
* Disallow "Yoda conditions".
|
|
173
|
+
*/
|
|
174
|
+
yoda: "error"
|
|
175
|
+
};
|
|
176
|
+
//#endregion
|
|
177
|
+
export { bestPracticeRules };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/oxlint/rules/imports.d.ts
|
|
4
|
+
declare const importRules: {
|
|
5
|
+
/**
|
|
6
|
+
* Disallow non-import statements appearing before import statements.
|
|
7
|
+
*/
|
|
8
|
+
"import/first": "error";
|
|
9
|
+
"import/max-dependencies": ["error", {
|
|
10
|
+
ignoreTypeImports: true;
|
|
11
|
+
max: number;
|
|
12
|
+
}];
|
|
13
|
+
/**
|
|
14
|
+
* Require a newline after the last import.
|
|
15
|
+
*/
|
|
16
|
+
"import/newline-after-import": ["error", {
|
|
17
|
+
considerComments: true;
|
|
18
|
+
count: number;
|
|
19
|
+
exactCount: true;
|
|
20
|
+
}];
|
|
21
|
+
/**
|
|
22
|
+
* Disallow import of modules using absolute paths.
|
|
23
|
+
*/
|
|
24
|
+
"import/no-absolute-path": "error";
|
|
25
|
+
/**
|
|
26
|
+
* Disallow cyclical dependencies between modules.
|
|
27
|
+
*/
|
|
28
|
+
"import/no-cycle": "error";
|
|
29
|
+
/**
|
|
30
|
+
* Disallow default exports.
|
|
31
|
+
*/
|
|
32
|
+
"import/no-default-export": "error";
|
|
33
|
+
/**
|
|
34
|
+
* Combine separate imports of resolved paths.
|
|
35
|
+
*/
|
|
36
|
+
"import/no-duplicates": ["error", {
|
|
37
|
+
considerQueryString: true;
|
|
38
|
+
}];
|
|
39
|
+
/**
|
|
40
|
+
* Disallow the use of extraneous packages.
|
|
41
|
+
* NOT YET IMPLEMENTED - https://github.com/oxc-project/oxc/issues/1117
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Disallow mutable exports.
|
|
45
|
+
*/
|
|
46
|
+
"import/no-mutable-exports": "error";
|
|
47
|
+
/**
|
|
48
|
+
* Disallow importing packages through relative paths.
|
|
49
|
+
* NOT YET IMPLEMENTED - https://github.com/oxc-project/oxc/issues/1117
|
|
50
|
+
*/
|
|
51
|
+
"import/no-unassigned-import": ["error", {
|
|
52
|
+
allow: string[];
|
|
53
|
+
}];
|
|
54
|
+
/**
|
|
55
|
+
* Disallow a module from importing itself.
|
|
56
|
+
*/
|
|
57
|
+
"import/no-self-import": "error";
|
|
58
|
+
"import/group-exports": "off";
|
|
59
|
+
"import/exports-last": "off";
|
|
60
|
+
"import/no-anonymous-default-export": "off";
|
|
61
|
+
"import/no-named-export": "off";
|
|
62
|
+
"import/no-nodejs-modules": "off";
|
|
63
|
+
"import/no-relative-parent-imports": "off";
|
|
64
|
+
"import/prefer-default-export": "off";
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { importRules };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
const importRules = {
|
|
5
|
+
"import/group-exports": "off",
|
|
6
|
+
"import/exports-last": "off",
|
|
7
|
+
"import/no-anonymous-default-export": "off",
|
|
8
|
+
"import/no-named-export": "off",
|
|
9
|
+
"import/no-nodejs-modules": "off",
|
|
10
|
+
"import/no-relative-parent-imports": "off",
|
|
11
|
+
"import/prefer-default-export": "off",
|
|
12
|
+
/**
|
|
13
|
+
* Disallow non-import statements appearing before import statements.
|
|
14
|
+
*/
|
|
15
|
+
"import/first": "error",
|
|
16
|
+
"import/max-dependencies": ["error", {
|
|
17
|
+
ignoreTypeImports: true,
|
|
18
|
+
max: 50
|
|
19
|
+
}],
|
|
20
|
+
/**
|
|
21
|
+
* Require a newline after the last import.
|
|
22
|
+
*/
|
|
23
|
+
"import/newline-after-import": ["error", {
|
|
24
|
+
considerComments: true,
|
|
25
|
+
count: 1,
|
|
26
|
+
exactCount: true
|
|
27
|
+
}],
|
|
28
|
+
/**
|
|
29
|
+
* Disallow import of modules using absolute paths.
|
|
30
|
+
*/
|
|
31
|
+
"import/no-absolute-path": "error",
|
|
32
|
+
/**
|
|
33
|
+
* Disallow cyclical dependencies between modules.
|
|
34
|
+
*/
|
|
35
|
+
"import/no-cycle": "error",
|
|
36
|
+
/**
|
|
37
|
+
* Disallow default exports.
|
|
38
|
+
*/
|
|
39
|
+
"import/no-default-export": "error",
|
|
40
|
+
/**
|
|
41
|
+
* Combine separate imports of resolved paths.
|
|
42
|
+
*/
|
|
43
|
+
"import/no-duplicates": ["error", { considerQueryString: true }],
|
|
44
|
+
/**
|
|
45
|
+
* Disallow the use of extraneous packages.
|
|
46
|
+
* NOT YET IMPLEMENTED - https://github.com/oxc-project/oxc/issues/1117
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Disallow mutable exports.
|
|
50
|
+
*/
|
|
51
|
+
"import/no-mutable-exports": "error",
|
|
52
|
+
/**
|
|
53
|
+
* Disallow importing packages through relative paths.
|
|
54
|
+
* NOT YET IMPLEMENTED - https://github.com/oxc-project/oxc/issues/1117
|
|
55
|
+
*/
|
|
56
|
+
"import/no-unassigned-import": ["error", { allow: [
|
|
57
|
+
"**/*.css",
|
|
58
|
+
"**/*.d.ts",
|
|
59
|
+
"server-only"
|
|
60
|
+
] }],
|
|
61
|
+
/**
|
|
62
|
+
* Disallow a module from importing itself.
|
|
63
|
+
*/
|
|
64
|
+
"import/no-self-import": "error"
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { importRules };
|