@longzai-intelligence/oxlint-plugin-typescript-eslint 0.0.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/configs/recommended.cjs +1 -0
- package/dist/configs/recommended.d.cts +6 -0
- package/dist/configs/recommended.d.mts +6 -0
- package/dist/configs/recommended.mjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.mjs +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e={"@longzai-intelligence/typescript-eslint/consistent-type-assertions":`error`};exports.recommended=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={"@longzai-intelligence/typescript-eslint/consistent-type-assertions":`error`};export{e as recommended};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require(`@oxlint/plugins`);function t(e){return typeof e==`object`&&!!e&&`typeAnnotation`in e&&e.typeAnnotation!==null&&typeof e.typeAnnotation==`object`}function n(e){return typeof e==`object`&&!!e}function r(e){return typeof e==`object`&&!!e}function i(e){if(!n(e)||!(`type`in e)||e.type!==`TSTypeReference`||!(`typeName`in e)||e.typeName===null||typeof e.typeName!=`object`)return!1;let t=e.typeName;return r(t)?`name`in t&&t.name===`const`:!1}function a(e){return!n(e)||!(`type`in e)?!1:e.type===`TSTypeLiteral`}function o(e,n,r){if(!t(e))return;let o=e.typeAnnotation;if(r.assertionStyle===`never`){if(i(o))return;n.report({node:e,message:`禁止使用 as 类型断言,请使用类型守卫或 Zod 进行类型验证`});return}if(r.assertionStyle===`angle-bracket`){if(i(o)||r.objectLiteralTypeAssertions&&a(o))return;n.report({node:e,message:`应使用尖括号断言而非 as 断言`});return}}function s(e,n,r){if(r.assertionStyle===`never`){n.report({node:e,message:`禁止使用尖括号类型断言,请使用类型守卫或 Zod 进行类型验证`});return}if(r.assertionStyle===`as`){if(t(e)&&r.objectLiteralTypeAssertions&&a(e.typeAnnotation))return;n.report({node:e,message:`应使用 as 断言而非尖括号断言`});return}}function c(e,t,n){n.assertionStyle===`never`&&t.report({node:e,message:`禁止使用非空断言 (!),请使用类型守卫或 Zod 进行类型验证`})}function l(e){return e===`never`||e===`as`||e===`angle-bracket`}function u(e){return typeof e==`object`&&!!e}function d(e){return!u(e)||!(`assertionStyle`in e)?!1:l(e.assertionStyle)}function f(e){let t={assertionStyle:`never`,objectLiteralTypeAssertions:!1};if(!Array.isArray(e)||e.length===0)return t;let n=e[0];return d(n)?{assertionStyle:n.assertionStyle,objectLiteralTypeAssertions:n.objectLiteralTypeAssertions??!1}:t}const p=(0,e.defineRule)({meta:{type:`suggestion`,docs:{description:`禁止使用类型断言,强制使用类型守卫或 Zod 进行类型验证`}},createOnce(e){let t=f(e.options);return{TSAsExpression(n){o(n,e,t)},TSTypeAssertion(n){s(n,e,t)},TSNonNullExpression(n){c(n,e,t)}}}}),m={"consistent-type-assertions":p},h=(0,e.eslintCompatPlugin)({meta:{name:`@longzai-intelligence/typescript-eslint`},rules:m});exports.consistentTypeAssertionsRule=p,exports.default=h,exports.typescriptEslintPlugin=h,exports.typescriptEslintRules=m;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as _$_oxlint_plugins0 from "@oxlint/plugins";
|
|
2
|
+
import { Rule } from "@oxlint/plugins";
|
|
3
|
+
|
|
4
|
+
//#region src/rules/consistent-type-assertions/types.d.ts
|
|
5
|
+
type AssertionStyle = 'never' | 'as' | 'angle-bracket';
|
|
6
|
+
type ConsistentTypeAssertionsOptions = {
|
|
7
|
+
assertionStyle: AssertionStyle;
|
|
8
|
+
objectLiteralTypeAssertions?: boolean;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/rules/consistent-type-assertions/index.d.ts
|
|
12
|
+
declare const consistentTypeAssertionsRule: _$_oxlint_plugins0.Rule;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/index.d.ts
|
|
15
|
+
declare const typescriptEslintRules: Record<string, Rule>;
|
|
16
|
+
declare const typescriptEslintPlugin: _$_oxlint_plugins0.Plugin;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { type AssertionStyle, type ConsistentTypeAssertionsOptions, consistentTypeAssertionsRule, typescriptEslintPlugin as default, typescriptEslintPlugin, typescriptEslintRules };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as _$_oxlint_plugins0 from "@oxlint/plugins";
|
|
2
|
+
import { Rule } from "@oxlint/plugins";
|
|
3
|
+
|
|
4
|
+
//#region src/rules/consistent-type-assertions/types.d.ts
|
|
5
|
+
type AssertionStyle = 'never' | 'as' | 'angle-bracket';
|
|
6
|
+
type ConsistentTypeAssertionsOptions = {
|
|
7
|
+
assertionStyle: AssertionStyle;
|
|
8
|
+
objectLiteralTypeAssertions?: boolean;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/rules/consistent-type-assertions/index.d.ts
|
|
12
|
+
declare const consistentTypeAssertionsRule: _$_oxlint_plugins0.Rule;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/index.d.ts
|
|
15
|
+
declare const typescriptEslintRules: Record<string, Rule>;
|
|
16
|
+
declare const typescriptEslintPlugin: _$_oxlint_plugins0.Plugin;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { type AssertionStyle, type ConsistentTypeAssertionsOptions, consistentTypeAssertionsRule, typescriptEslintPlugin as default, typescriptEslintPlugin, typescriptEslintRules };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(e){return typeof e==`object`&&!!e&&`typeAnnotation`in e&&e.typeAnnotation!==null&&typeof e.typeAnnotation==`object`}function r(e){return typeof e==`object`&&!!e}function i(e){return typeof e==`object`&&!!e}function a(e){if(!r(e)||!(`type`in e)||e.type!==`TSTypeReference`||!(`typeName`in e)||e.typeName===null||typeof e.typeName!=`object`)return!1;let t=e.typeName;return i(t)?`name`in t&&t.name===`const`:!1}function o(e){return!r(e)||!(`type`in e)?!1:e.type===`TSTypeLiteral`}function s(e,t,r){if(!n(e))return;let i=e.typeAnnotation;if(r.assertionStyle===`never`){if(a(i))return;t.report({node:e,message:`禁止使用 as 类型断言,请使用类型守卫或 Zod 进行类型验证`});return}if(r.assertionStyle===`angle-bracket`){if(a(i)||r.objectLiteralTypeAssertions&&o(i))return;t.report({node:e,message:`应使用尖括号断言而非 as 断言`});return}}function c(e,t,r){if(r.assertionStyle===`never`){t.report({node:e,message:`禁止使用尖括号类型断言,请使用类型守卫或 Zod 进行类型验证`});return}if(r.assertionStyle===`as`){if(n(e)&&r.objectLiteralTypeAssertions&&o(e.typeAnnotation))return;t.report({node:e,message:`应使用 as 断言而非尖括号断言`});return}}function l(e,t,n){n.assertionStyle===`never`&&t.report({node:e,message:`禁止使用非空断言 (!),请使用类型守卫或 Zod 进行类型验证`})}function u(e){return e===`never`||e===`as`||e===`angle-bracket`}function d(e){return typeof e==`object`&&!!e}function f(e){return!d(e)||!(`assertionStyle`in e)?!1:u(e.assertionStyle)}function p(e){let t={assertionStyle:`never`,objectLiteralTypeAssertions:!1};if(!Array.isArray(e)||e.length===0)return t;let n=e[0];return f(n)?{assertionStyle:n.assertionStyle,objectLiteralTypeAssertions:n.objectLiteralTypeAssertions??!1}:t}const m=e({meta:{type:`suggestion`,docs:{description:`禁止使用类型断言,强制使用类型守卫或 Zod 进行类型验证`}},createOnce(e){let t=p(e.options);return{TSAsExpression(n){s(n,e,t)},TSTypeAssertion(n){c(n,e,t)},TSNonNullExpression(n){l(n,e,t)}}}}),h={"consistent-type-assertions":m},g=t({meta:{name:`@longzai-intelligence/typescript-eslint`},rules:h});export{m as consistentTypeAssertionsRule,g as default,g as typescriptEslintPlugin,h as typescriptEslintRules};
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@longzai-intelligence/oxlint-plugin-typescript-eslint",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Oxlint TypeScript ESLint 兼容插件,提供 typescript-eslint 规则的 Oxlint 实现",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/index.cjs",
|
|
11
|
+
"module": "./dist/index.mjs",
|
|
12
|
+
"types": "./dist/index.d.mts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": {
|
|
16
|
+
"import": "./dist/index.d.mts",
|
|
17
|
+
"require": "./dist/index.d.cts"
|
|
18
|
+
},
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"require": "./dist/index.cjs"
|
|
21
|
+
},
|
|
22
|
+
"./configs/recommended": {
|
|
23
|
+
"types": {
|
|
24
|
+
"import": "./dist/configs/recommended.d.mts",
|
|
25
|
+
"require": "./dist/configs/recommended.d.cts"
|
|
26
|
+
},
|
|
27
|
+
"import": "./dist/configs/recommended.mjs",
|
|
28
|
+
"require": "./dist/configs/recommended.cjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsdown",
|
|
33
|
+
"build:prod": "NODE_ENV=production tsdown",
|
|
34
|
+
"prepublishOnly": "bun run build:prod",
|
|
35
|
+
"dev": "tsdown --watch",
|
|
36
|
+
"clean": "rimraf dist",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:watch": "vitest",
|
|
39
|
+
"test:coverage": "vitest run --coverage",
|
|
40
|
+
"lint": "bun run lint:oxlint",
|
|
41
|
+
"lint:oxlint": "oxlint",
|
|
42
|
+
"lint:eslint": "eslint .",
|
|
43
|
+
"lint:fix": "bun run oxc:fix",
|
|
44
|
+
"lint:fix:oxlint": "oxlint --fix",
|
|
45
|
+
"lint:fix:eslint": "eslint . --fix",
|
|
46
|
+
"typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
|
|
47
|
+
"typecheck:app": "tsc --noEmit -p tsconfig/app.json",
|
|
48
|
+
"typecheck:node": "tsc --noEmit -p tsconfig/node.json",
|
|
49
|
+
"typecheck:test": "tsc --noEmit -p tsconfig/test.json",
|
|
50
|
+
"lint:file": "bun run lint:file:oxlint",
|
|
51
|
+
"lint:file:oxlint": "oxlint",
|
|
52
|
+
"lint:file:eslint": "eslint",
|
|
53
|
+
"fmt": "oxfmt",
|
|
54
|
+
"fmt:check": "oxfmt --check",
|
|
55
|
+
"oxc": "bun run lint:oxlint && bun run fmt:check",
|
|
56
|
+
"oxc:fix": "bun run lint:fix:oxlint && bun run fmt"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@longzai-intelligence/oxlint-core": "0.0.1",
|
|
60
|
+
"@oxlint/plugins": "^1.64.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@longzai-intelligence/eslint-preset-library": "0.2.13",
|
|
64
|
+
"@longzai-intelligence/oxlint-config": "0.0.1",
|
|
65
|
+
"@longzai-intelligence/oxlint-plugin-architecture": "0.0.1",
|
|
66
|
+
"@longzai-intelligence/oxlint-plugin-code-style": "0.0.1",
|
|
67
|
+
"@longzai-intelligence/oxlint-plugin-package-json": "0.0.1",
|
|
68
|
+
"@longzai-intelligence/oxlint-plugin-perfectionist": "0.0.1",
|
|
69
|
+
"@longzai-intelligence/oxlint-plugin-schema-type-separation": "0.0.1",
|
|
70
|
+
"@longzai-intelligence/oxlint-plugin-stylistic": "0.0.1",
|
|
71
|
+
"@longzai-intelligence/oxlint-plugin-tsdoc": "0.0.1",
|
|
72
|
+
"@longzai-intelligence/oxlint-plugin-typescript-eslint": "0.0.1",
|
|
73
|
+
"@longzai-intelligence/oxlint-plugin-zod": "0.0.1",
|
|
74
|
+
"@longzai-intelligence/oxlint-utils": "0.0.1",
|
|
75
|
+
"@longzai-intelligence/tsdown-config": "0.0.1",
|
|
76
|
+
"@longzai-intelligence/typescript-config": "0.0.3",
|
|
77
|
+
"@longzai-intelligence/vitest-config": "0.0.10",
|
|
78
|
+
"@types/node": "^25.7.0",
|
|
79
|
+
"oxlint": "^1.64.0",
|
|
80
|
+
"rimraf": "^6.1.3",
|
|
81
|
+
"tsdown": "^0.21.10",
|
|
82
|
+
"typescript": "^6.0.3",
|
|
83
|
+
"vitest": "^4.1.6"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"oxlint": ">=1.0.0"
|
|
87
|
+
}
|
|
88
|
+
}
|