eslint-plugin-conventions 4.2.3 → 4.2.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/package.json +5 -17
- package/src/index.d.ts +15 -173
- package/src/index.js +1 -8
- package/src/lib/eslint-plugin-conventions.js +0 -1
- package/src/oxlint.d.ts +17 -20
- package/src/oxlint.js +0 -19
- package/src/rules/conventions/analytics-event-naming.js +0 -11
- package/src/rules/conventions/consistent-existence-index-check.js +0 -15
- package/src/rules/conventions/expiring-todo-comments.js +2 -35
- package/src/rules/conventions/filename-case.js +1 -40
- package/src/rules/conventions/no-commented-code.js +1 -43
- package/src/rules/conventions/no-console-spaces.js +0 -20
- package/src/rules/conventions/no-json-schema-tags.js +1 -28
- package/src/rules/conventions/no-magic-numbers.js +1 -21
- package/src/rules/conventions/no-raw-cross-property-href.js +0 -10
- package/src/rules/conventions/prefer-code-point.js +0 -18
- package/src/rules/conventions/prefer-dependency-version-strategy.js +0 -26
- package/src/rules/conventions/prefer-dom-node-text-content.js +0 -20
- package/src/rules/conventions/require-data-testid.js +1 -31
- package/src/rules/conventions/utm-taxonomy.js +0 -11
- package/src/rules/deprecation/no-deprecated-api.js +1 -19
- package/CHANGELOG.md +0 -183
- package/src/index.js.map +0 -1
- package/src/lib/eslint-plugin-conventions.d.ts +0 -1
- package/src/lib/eslint-plugin-conventions.js.map +0 -1
- package/src/oxlint.js.map +0 -1
- package/src/rules/conventions/analytics-event-naming.d.ts +0 -41
- package/src/rules/conventions/analytics-event-naming.js.map +0 -1
- package/src/rules/conventions/consistent-existence-index-check.d.ts +0 -19
- package/src/rules/conventions/consistent-existence-index-check.js.map +0 -1
- package/src/rules/conventions/expiring-todo-comments.d.ts +0 -65
- package/src/rules/conventions/expiring-todo-comments.js.map +0 -1
- package/src/rules/conventions/filename-case.d.ts +0 -32
- package/src/rules/conventions/filename-case.js.map +0 -1
- package/src/rules/conventions/no-commented-code.d.ts +0 -26
- package/src/rules/conventions/no-commented-code.js.map +0 -1
- package/src/rules/conventions/no-console-spaces.d.ts +0 -13
- package/src/rules/conventions/no-console-spaces.js.map +0 -1
- package/src/rules/conventions/no-json-schema-tags.d.ts +0 -29
- package/src/rules/conventions/no-json-schema-tags.js.map +0 -1
- package/src/rules/conventions/no-magic-numbers.d.ts +0 -41
- package/src/rules/conventions/no-magic-numbers.js.map +0 -1
- package/src/rules/conventions/no-raw-cross-property-href.d.ts +0 -24
- package/src/rules/conventions/no-raw-cross-property-href.js.map +0 -1
- package/src/rules/conventions/prefer-code-point.d.ts +0 -13
- package/src/rules/conventions/prefer-code-point.js.map +0 -1
- package/src/rules/conventions/prefer-dependency-version-strategy.d.ts +0 -29
- package/src/rules/conventions/prefer-dependency-version-strategy.js.map +0 -1
- package/src/rules/conventions/prefer-dom-node-text-content.d.ts +0 -13
- package/src/rules/conventions/prefer-dom-node-text-content.js.map +0 -1
- package/src/rules/conventions/require-data-testid.d.ts +0 -56
- package/src/rules/conventions/require-data-testid.js.map +0 -1
- package/src/rules/conventions/utm-taxonomy.d.ts +0 -25
- package/src/rules/conventions/utm-taxonomy.js.map +0 -1
- package/src/rules/deprecation/no-deprecated-api.d.ts +0 -30
- package/src/rules/deprecation/no-deprecated-api.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-conventions",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "ESLint plugin for team code conventions — enforces filename case, magic-number bans, commented-out code, expiring TODOs, and deprecated-API usage.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -22,10 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"src/",
|
|
25
|
-
"dist/",
|
|
26
25
|
"README.md",
|
|
27
|
-
"LICENSE"
|
|
28
|
-
"CHANGELOG.md"
|
|
26
|
+
"LICENSE"
|
|
29
27
|
],
|
|
30
28
|
"keywords": [
|
|
31
29
|
"eslint",
|
|
@@ -53,32 +51,22 @@
|
|
|
53
51
|
},
|
|
54
52
|
"dependencies": {
|
|
55
53
|
"tslib": "^2.3.0",
|
|
56
|
-
"@interlace/eslint-devkit": "
|
|
57
|
-
},
|
|
58
|
-
"devDependencies": {
|
|
59
|
-
"@typescript-eslint/parser": "^8.46.2",
|
|
60
|
-
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
54
|
+
"@interlace/eslint-devkit": "^1.6.1"
|
|
61
55
|
},
|
|
62
56
|
"repository": {
|
|
63
57
|
"type": "git",
|
|
64
|
-
"url": "https://github.com/ofri-peretz/eslint",
|
|
58
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git",
|
|
65
59
|
"directory": "packages/eslint-plugin-conventions"
|
|
66
60
|
},
|
|
67
61
|
"homepage": "https://eslint.interlace.tools/docs/quality/plugin-conventions?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-conventions",
|
|
68
62
|
"bugs": {
|
|
69
63
|
"url": "https://github.com/ofri-peretz/eslint/issues"
|
|
70
64
|
},
|
|
71
|
-
"scripts": {
|
|
72
|
-
"build": "tsx ../../scripts/build-package.ts",
|
|
73
|
-
"test": "vitest run",
|
|
74
|
-
"test:coverage": "vitest run --coverage",
|
|
75
|
-
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
76
|
-
},
|
|
77
65
|
"peerDependencies": {
|
|
78
66
|
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
|
|
79
67
|
},
|
|
80
68
|
"funding": {
|
|
81
69
|
"type": "github",
|
|
82
|
-
"url": "https://github.com/ofri-peretz/eslint"
|
|
70
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git"
|
|
83
71
|
}
|
|
84
72
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,175 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'expiring-todo-comments': TSESLint.RuleModule<"expiringTodoComment" | "invalidTodoCondition" | "multipleTodoConditions", [(import("./rules/conventions/expiring-todo-comments").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
12
|
-
name: string;
|
|
13
|
-
};
|
|
14
|
-
'prefer-code-point': TSESLint.RuleModule<"preferCodePoint", [], unknown, TSESLint.RuleListener> & {
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
17
|
-
'prefer-dom-node-text-content': TSESLint.RuleModule<"preferDomNodeTextContent", [], unknown, TSESLint.RuleListener> & {
|
|
18
|
-
name: string;
|
|
19
|
-
};
|
|
20
|
-
'no-console-spaces': TSESLint.RuleModule<"noConsoleSpaces", [], unknown, TSESLint.RuleListener> & {
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
23
|
-
'no-deprecated-api': TSESLint.RuleModule<"deprecatedAPI" | "useReplacement", [(import("./rules/deprecation/no-deprecated-api").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
24
|
-
name: string;
|
|
25
|
-
};
|
|
26
|
-
'prefer-dependency-version-strategy': TSESLint.RuleModule<"preferStrategy" | "invalidStrategy", [(import("./rules/conventions/prefer-dependency-version-strategy").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
27
|
-
name: string;
|
|
28
|
-
};
|
|
29
|
-
'filename-case': TSESLint.RuleModule<"filenameCase", [(import("./rules/conventions/filename-case").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
30
|
-
name: string;
|
|
31
|
-
};
|
|
32
|
-
'consistent-existence-index-check': TSESLint.RuleModule<"consistentExistenceCheck", [(import("./rules/conventions/consistent-existence-index-check").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
33
|
-
name: string;
|
|
34
|
-
};
|
|
35
|
-
'no-json-schema-tags': TSESLint.RuleModule<"jsonSchemaTag" | "moveToDescription", [(import("./rules/conventions/no-json-schema-tags").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
36
|
-
name: string;
|
|
37
|
-
};
|
|
38
|
-
'require-data-testid': TSESLint.RuleModule<"missingDataTestId" | "dynamicDataTestId", [(import("./rules/conventions/require-data-testid").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
39
|
-
name: string;
|
|
40
|
-
};
|
|
41
|
-
'utm-taxonomy': TSESLint.RuleModule<"invalidUtmSource" | "invalidUtmMedium", [], unknown, TSESLint.RuleListener> & {
|
|
42
|
-
name: string;
|
|
43
|
-
};
|
|
44
|
-
'no-raw-cross-property-href': TSESLint.RuleModule<"rawCrossPropertyHref", [], unknown, TSESLint.RuleListener> & {
|
|
45
|
-
name: string;
|
|
46
|
-
};
|
|
47
|
-
'analytics-event-naming': TSESLint.RuleModule<"invalidEventName" | "interpolatedEventName", [], unknown, TSESLint.RuleListener> & {
|
|
48
|
-
name: string;
|
|
49
|
-
};
|
|
50
|
-
'no-magic-numbers': TSESLint.RuleModule<"noMagicNumber" | "extractConst", [(import("./rules/conventions/no-magic-numbers").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
51
|
-
name: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
1
|
+
// Minimal declaration written by scripts/build-package.ts.
|
|
2
|
+
//
|
|
3
|
+
// tsc's generated entry declaration inlined every inferred rule-option type
|
|
4
|
+
// (up to 166 kB per plugin) for an API no consumer calls directly. This types
|
|
5
|
+
// what a flat config actually touches. Per-rule option types remain available
|
|
6
|
+
// from the "./types" subpath export where a plugin provides one.
|
|
7
|
+
import type { Linter, Rule } from 'eslint';
|
|
8
|
+
|
|
9
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
10
|
+
export declare const configs: Record<string, Linter.Config>;
|
|
54
11
|
export declare const plugin: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
version: string;
|
|
58
|
-
};
|
|
59
|
-
rules: {
|
|
60
|
-
'no-commented-code': TSESLint.RuleModule<"commentedCode" | "removeCode" | "useVersionControl", [(import("./rules/conventions/no-commented-code").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
61
|
-
name: string;
|
|
62
|
-
};
|
|
63
|
-
'expiring-todo-comments': TSESLint.RuleModule<"expiringTodoComment" | "invalidTodoCondition" | "multipleTodoConditions", [(import("./rules/conventions/expiring-todo-comments").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
64
|
-
name: string;
|
|
65
|
-
};
|
|
66
|
-
'prefer-code-point': TSESLint.RuleModule<"preferCodePoint", [], unknown, TSESLint.RuleListener> & {
|
|
67
|
-
name: string;
|
|
68
|
-
};
|
|
69
|
-
'prefer-dom-node-text-content': TSESLint.RuleModule<"preferDomNodeTextContent", [], unknown, TSESLint.RuleListener> & {
|
|
70
|
-
name: string;
|
|
71
|
-
};
|
|
72
|
-
'no-console-spaces': TSESLint.RuleModule<"noConsoleSpaces", [], unknown, TSESLint.RuleListener> & {
|
|
73
|
-
name: string;
|
|
74
|
-
};
|
|
75
|
-
'no-deprecated-api': TSESLint.RuleModule<"deprecatedAPI" | "useReplacement", [(import("./rules/deprecation/no-deprecated-api").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
76
|
-
name: string;
|
|
77
|
-
};
|
|
78
|
-
'prefer-dependency-version-strategy': TSESLint.RuleModule<"preferStrategy" | "invalidStrategy", [(import("./rules/conventions/prefer-dependency-version-strategy").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
79
|
-
name: string;
|
|
80
|
-
};
|
|
81
|
-
'filename-case': TSESLint.RuleModule<"filenameCase", [(import("./rules/conventions/filename-case").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
82
|
-
name: string;
|
|
83
|
-
};
|
|
84
|
-
'consistent-existence-index-check': TSESLint.RuleModule<"consistentExistenceCheck", [(import("./rules/conventions/consistent-existence-index-check").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
85
|
-
name: string;
|
|
86
|
-
};
|
|
87
|
-
'no-json-schema-tags': TSESLint.RuleModule<"jsonSchemaTag" | "moveToDescription", [(import("./rules/conventions/no-json-schema-tags").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
88
|
-
name: string;
|
|
89
|
-
};
|
|
90
|
-
'require-data-testid': TSESLint.RuleModule<"missingDataTestId" | "dynamicDataTestId", [(import("./rules/conventions/require-data-testid").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
91
|
-
name: string;
|
|
92
|
-
};
|
|
93
|
-
'utm-taxonomy': TSESLint.RuleModule<"invalidUtmSource" | "invalidUtmMedium", [], unknown, TSESLint.RuleListener> & {
|
|
94
|
-
name: string;
|
|
95
|
-
};
|
|
96
|
-
'no-raw-cross-property-href': TSESLint.RuleModule<"rawCrossPropertyHref", [], unknown, TSESLint.RuleListener> & {
|
|
97
|
-
name: string;
|
|
98
|
-
};
|
|
99
|
-
'analytics-event-naming': TSESLint.RuleModule<"invalidEventName" | "interpolatedEventName", [], unknown, TSESLint.RuleListener> & {
|
|
100
|
-
name: string;
|
|
101
|
-
};
|
|
102
|
-
'no-magic-numbers': TSESLint.RuleModule<"noMagicNumber" | "extractConst", [(import("./rules/conventions/no-magic-numbers").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
103
|
-
name: string;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
export declare const configs: {
|
|
108
|
-
recommended: {
|
|
109
|
-
plugins: {
|
|
110
|
-
conventions: {
|
|
111
|
-
meta: {
|
|
112
|
-
name: string;
|
|
113
|
-
version: string;
|
|
114
|
-
};
|
|
115
|
-
rules: {
|
|
116
|
-
'no-commented-code': TSESLint.RuleModule<"commentedCode" | "removeCode" | "useVersionControl", [(import("./rules/conventions/no-commented-code").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
117
|
-
name: string;
|
|
118
|
-
};
|
|
119
|
-
'expiring-todo-comments': TSESLint.RuleModule<"expiringTodoComment" | "invalidTodoCondition" | "multipleTodoConditions", [(import("./rules/conventions/expiring-todo-comments").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
120
|
-
name: string;
|
|
121
|
-
};
|
|
122
|
-
'prefer-code-point': TSESLint.RuleModule<"preferCodePoint", [], unknown, TSESLint.RuleListener> & {
|
|
123
|
-
name: string;
|
|
124
|
-
};
|
|
125
|
-
'prefer-dom-node-text-content': TSESLint.RuleModule<"preferDomNodeTextContent", [], unknown, TSESLint.RuleListener> & {
|
|
126
|
-
name: string;
|
|
127
|
-
};
|
|
128
|
-
'no-console-spaces': TSESLint.RuleModule<"noConsoleSpaces", [], unknown, TSESLint.RuleListener> & {
|
|
129
|
-
name: string;
|
|
130
|
-
};
|
|
131
|
-
'no-deprecated-api': TSESLint.RuleModule<"deprecatedAPI" | "useReplacement", [(import("./rules/deprecation/no-deprecated-api").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
132
|
-
name: string;
|
|
133
|
-
};
|
|
134
|
-
'prefer-dependency-version-strategy': TSESLint.RuleModule<"preferStrategy" | "invalidStrategy", [(import("./rules/conventions/prefer-dependency-version-strategy").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
135
|
-
name: string;
|
|
136
|
-
};
|
|
137
|
-
'filename-case': TSESLint.RuleModule<"filenameCase", [(import("./rules/conventions/filename-case").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
138
|
-
name: string;
|
|
139
|
-
};
|
|
140
|
-
'consistent-existence-index-check': TSESLint.RuleModule<"consistentExistenceCheck", [(import("./rules/conventions/consistent-existence-index-check").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
141
|
-
name: string;
|
|
142
|
-
};
|
|
143
|
-
'no-json-schema-tags': TSESLint.RuleModule<"jsonSchemaTag" | "moveToDescription", [(import("./rules/conventions/no-json-schema-tags").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
144
|
-
name: string;
|
|
145
|
-
};
|
|
146
|
-
'require-data-testid': TSESLint.RuleModule<"missingDataTestId" | "dynamicDataTestId", [(import("./rules/conventions/require-data-testid").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
147
|
-
name: string;
|
|
148
|
-
};
|
|
149
|
-
'utm-taxonomy': TSESLint.RuleModule<"invalidUtmSource" | "invalidUtmMedium", [], unknown, TSESLint.RuleListener> & {
|
|
150
|
-
name: string;
|
|
151
|
-
};
|
|
152
|
-
'no-raw-cross-property-href': TSESLint.RuleModule<"rawCrossPropertyHref", [], unknown, TSESLint.RuleListener> & {
|
|
153
|
-
name: string;
|
|
154
|
-
};
|
|
155
|
-
'analytics-event-naming': TSESLint.RuleModule<"invalidEventName" | "interpolatedEventName", [], unknown, TSESLint.RuleListener> & {
|
|
156
|
-
name: string;
|
|
157
|
-
};
|
|
158
|
-
'no-magic-numbers': TSESLint.RuleModule<"noMagicNumber" | "extractConst", [(import("./rules/conventions/no-magic-numbers").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
159
|
-
name: string;
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
rules: {
|
|
165
|
-
'conventions/no-commented-code': "warn";
|
|
166
|
-
'conventions/expiring-todo-comments': "warn";
|
|
167
|
-
'conventions/no-deprecated-api': "warn";
|
|
168
|
-
'conventions/utm-taxonomy': "error";
|
|
169
|
-
'conventions/no-raw-cross-property-href': "error";
|
|
170
|
-
'conventions/analytics-event-naming': "error";
|
|
171
|
-
'conventions/no-magic-numbers': "warn";
|
|
172
|
-
};
|
|
173
|
-
};
|
|
12
|
+
meta: { name: string; version: string };
|
|
13
|
+
rules: Record<string, Rule.RuleModule>;
|
|
174
14
|
};
|
|
175
|
-
|
|
15
|
+
|
|
16
|
+
declare const _default: typeof plugin;
|
|
17
|
+
export default _default;
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.configs = exports.plugin = exports.rules = void 0;
|
|
9
|
-
// Conventions rules
|
|
10
4
|
const no_commented_code_1 = require("./rules/conventions/no-commented-code");
|
|
11
5
|
const expiring_todo_comments_1 = require("./rules/conventions/expiring-todo-comments");
|
|
12
6
|
const prefer_code_point_1 = require("./rules/conventions/prefer-code-point");
|
|
@@ -42,7 +36,7 @@ exports.rules = {
|
|
|
42
36
|
exports.plugin = {
|
|
43
37
|
meta: {
|
|
44
38
|
name: 'eslint-plugin-conventions',
|
|
45
|
-
version: '4.2.
|
|
39
|
+
version: '4.2.4',
|
|
46
40
|
},
|
|
47
41
|
rules: exports.rules,
|
|
48
42
|
};
|
|
@@ -63,4 +57,3 @@ exports.configs = {
|
|
|
63
57
|
},
|
|
64
58
|
};
|
|
65
59
|
exports.default = exports.plugin;
|
|
66
|
-
//# sourceMappingURL=index.js.map
|
package/src/oxlint.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
import { plugin } from './index';
|
|
20
|
-
export = plugin;
|
|
1
|
+
// Minimal declaration written by scripts/build-package.ts.
|
|
2
|
+
//
|
|
3
|
+
// tsc's generated entry declaration inlined every inferred rule-option type
|
|
4
|
+
// (up to 166 kB per plugin) for an API no consumer calls directly. This types
|
|
5
|
+
// what a flat config actually touches. Per-rule option types remain available
|
|
6
|
+
// from the "./types" subpath export where a plugin provides one.
|
|
7
|
+
import type { Linter, Rule } from 'eslint';
|
|
8
|
+
|
|
9
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
10
|
+
export declare const configs: Record<string, Linter.Config>;
|
|
11
|
+
export declare const plugin: {
|
|
12
|
+
meta: { name: string; version: string };
|
|
13
|
+
rules: Record<string, Rule.RuleModule>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const _default: typeof plugin;
|
|
17
|
+
export default _default;
|
package/src/oxlint.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* oxlint sub-export.
|
|
9
|
-
*
|
|
10
|
-
* Consumers wire oxlint to this entry via:
|
|
11
|
-
* { "jsPlugins": ["eslint-plugin-conventions/oxlint"] }
|
|
12
|
-
*
|
|
13
|
-
* oxlint's JS plugin loader does `require('eslint-plugin-conventions/oxlint')` and reads
|
|
14
|
-
* `.rules` off the result. The compiled output of `export = plugin` is
|
|
15
|
-
* `module.exports = plugin`, which gives oxlint the plugin object directly
|
|
16
|
-
* (`{ meta, rules }`) — no wrapper, no `.default` indirection.
|
|
17
|
-
*
|
|
18
|
-
* Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
|
|
19
|
-
*/
|
|
20
2
|
const index_1 = require("./index");
|
|
21
3
|
module.exports = index_1.plugin;
|
|
22
|
-
//# sourceMappingURL=oxlint.js.map
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.analyticsEventNaming = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
5
|
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
11
|
-
// ANALYTICS_PHILOSOPHY.md principle 4 → fixed verb list. Edit there and
|
|
12
|
-
// here together.
|
|
13
6
|
const ACTION_VERBS = [
|
|
14
7
|
'click',
|
|
15
8
|
'submit',
|
|
@@ -61,15 +54,12 @@ exports.analyticsEventNaming = (0, eslint_devkit_1.createRule)({
|
|
|
61
54
|
defaultOptions: [],
|
|
62
55
|
create(context) {
|
|
63
56
|
function isCaptureLike(node) {
|
|
64
|
-
// <obj>.capture(...) — PostHog
|
|
65
|
-
// <obj>.track(...) — Segment / Mixpanel / Amplitude
|
|
66
57
|
if (node.callee.type === 'MemberExpression' &&
|
|
67
58
|
node.callee.property.type === 'Identifier' &&
|
|
68
59
|
(node.callee.property.name === 'capture' ||
|
|
69
60
|
node.callee.property.name === 'track')) {
|
|
70
61
|
return true;
|
|
71
62
|
}
|
|
72
|
-
// bare track(...) — our primitive
|
|
73
63
|
if (node.callee.type === 'Identifier' &&
|
|
74
64
|
node.callee.name === 'track') {
|
|
75
65
|
return true;
|
|
@@ -101,4 +91,3 @@ exports.analyticsEventNaming = (0, eslint_devkit_1.createRule)({
|
|
|
101
91
|
};
|
|
102
92
|
},
|
|
103
93
|
});
|
|
104
|
-
//# sourceMappingURL=analytics-event-naming.js.map
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.consistentExistenceIndexCheck = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -48,7 +43,6 @@ exports.consistentExistenceIndexCheck = (0, eslint_devkit_1.createRule)({
|
|
|
48
43
|
const { preferred = 'in' } = options || {};
|
|
49
44
|
function reportInconsistentCheck(node, currentMethod, object, property) {
|
|
50
45
|
let fix;
|
|
51
|
-
// Only provide fixes for standalone expressions, not when part of larger expressions
|
|
52
46
|
const parent = node.parent;
|
|
53
47
|
const isStandaloneExpression = !parent ||
|
|
54
48
|
parent.type === 'ExpressionStatement' ||
|
|
@@ -93,12 +87,7 @@ exports.consistentExistenceIndexCheck = (0, eslint_devkit_1.createRule)({
|
|
|
93
87
|
});
|
|
94
88
|
}
|
|
95
89
|
return {
|
|
96
|
-
// Check for hasOwnProperty calls
|
|
97
90
|
CallExpression(node) {
|
|
98
|
-
// Direct hasOwnProperty calls: obj.hasOwnProperty(prop). Reindented
|
|
99
|
-
// to match the sibling `if` blocks below — the original 6-space
|
|
100
|
-
// indent here suggested this branch was at a different scope level
|
|
101
|
-
// (CodeQL: `js/misleading-indentation-after-control-statement`).
|
|
102
91
|
if (node.callee.type === 'MemberExpression' &&
|
|
103
92
|
node.callee.property.type === 'Identifier' &&
|
|
104
93
|
node.callee.property.name === 'hasOwnProperty' &&
|
|
@@ -106,7 +95,6 @@ exports.consistentExistenceIndexCheck = (0, eslint_devkit_1.createRule)({
|
|
|
106
95
|
preferred !== 'hasOwnProperty') {
|
|
107
96
|
reportInconsistentCheck(node, 'hasOwnProperty', node.callee.object, node.arguments[0]);
|
|
108
97
|
}
|
|
109
|
-
// Object.prototype.hasOwnProperty.call(obj, prop)
|
|
110
98
|
if (node.callee.type === 'MemberExpression' &&
|
|
111
99
|
node.callee.object.type === 'MemberExpression' &&
|
|
112
100
|
node.callee.object.object.type === 'MemberExpression' &&
|
|
@@ -122,7 +110,6 @@ exports.consistentExistenceIndexCheck = (0, eslint_devkit_1.createRule)({
|
|
|
122
110
|
preferred !== 'hasOwnProperty') {
|
|
123
111
|
reportInconsistentCheck(node, 'Object.prototype.hasOwnProperty.call', node.arguments[0], node.arguments[1]);
|
|
124
112
|
}
|
|
125
|
-
// Object.hasOwn(obj, prop)
|
|
126
113
|
if (node.callee.type === 'MemberExpression' &&
|
|
127
114
|
node.callee.object.type === 'Identifier' &&
|
|
128
115
|
node.callee.object.name === 'Object' &&
|
|
@@ -133,7 +120,6 @@ exports.consistentExistenceIndexCheck = (0, eslint_devkit_1.createRule)({
|
|
|
133
120
|
reportInconsistentCheck(node, 'Object.hasOwn', node.arguments[0], node.arguments[1]);
|
|
134
121
|
}
|
|
135
122
|
},
|
|
136
|
-
// Check for 'in' operator usage
|
|
137
123
|
BinaryExpression(node) {
|
|
138
124
|
if (node.operator === 'in' && preferred !== 'in') {
|
|
139
125
|
reportInconsistentCheck(node, 'in', node.right, node.left);
|
|
@@ -142,4 +128,3 @@ exports.consistentExistenceIndexCheck = (0, eslint_devkit_1.createRule)({
|
|
|
142
128
|
};
|
|
143
129
|
},
|
|
144
130
|
});
|
|
145
|
-
//# sourceMappingURL=consistent-existence-index-check.js.map
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.expiringTodoComments = void 0;
|
|
9
4
|
exports.parseVersionParts = parseVersionParts;
|
|
@@ -19,12 +14,6 @@ const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
|
19
14
|
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
20
15
|
const eslint_devkit_3 = require("@interlace/eslint-devkit");
|
|
21
16
|
const eslint_devkit_4 = require("@interlace/eslint-devkit");
|
|
22
|
-
/**
|
|
23
|
-
* Normalize a version specifier (`^1.2.3`, `24.x`, `18`) into numeric
|
|
24
|
-
* major/minor/patch parts. Wildcard or non-numeric segments become 0 —
|
|
25
|
-
* without this, `package.json#engines.node: "24.x"` would compare as
|
|
26
|
-
* equal to everything, making every `>=` engine TODO falsely match.
|
|
27
|
-
*/
|
|
28
17
|
function parseVersionParts(version) {
|
|
29
18
|
const cleaned = version.replace(/^[\^~>=<]+/, '').trim();
|
|
30
19
|
const parts = cleaned
|
|
@@ -44,9 +33,7 @@ function compareVersions(version1, version2) {
|
|
|
44
33
|
return v1.patch - v2.patch;
|
|
45
34
|
}
|
|
46
35
|
function checkDateCondition(dateStr) {
|
|
47
|
-
|
|
48
|
-
// are always false, so malformed input safely reads as "not expired".
|
|
49
|
-
const conditionDate = new Date(dateStr + 'T00:00:00Z'); // UTC
|
|
36
|
+
const conditionDate = new Date(dateStr + 'T00:00:00Z');
|
|
50
37
|
const now = new Date();
|
|
51
38
|
return now >= conditionDate;
|
|
52
39
|
}
|
|
@@ -76,7 +63,6 @@ function checkEngineVersionCondition(pkg, engine, operator, targetVersion) {
|
|
|
76
63
|
const nodeVersion = pkg?.engines?.node;
|
|
77
64
|
if (!nodeVersion)
|
|
78
65
|
return false;
|
|
79
|
-
// Simple version comparison for engines
|
|
80
66
|
const currentVersion = nodeVersion.replace(/^[\^~>=<]+/, '');
|
|
81
67
|
const comparison = compareVersions(currentVersion, targetVersion);
|
|
82
68
|
switch (operator) {
|
|
@@ -104,25 +90,19 @@ function checkDependencyCondition(pkg, packageName, present) {
|
|
|
104
90
|
return present ? hasPackage : hasPackage;
|
|
105
91
|
}
|
|
106
92
|
function parseTodoCondition(commentValue, term) {
|
|
107
|
-
// Match patterns like: TODO [condition]: message
|
|
108
|
-
// or TODO (@author) [condition]: message
|
|
109
|
-
// Also handle block comments with * prefix: * TODO [condition]: message
|
|
110
93
|
const todoRegex = new RegExp(`\\*?\\s*${term}\\s*(?:\\([^)]+\\))?\\s*\\[([^\\]]+)\\]\\s*:\\s*(.+)$`, 'im');
|
|
111
94
|
const match = commentValue.match(todoRegex);
|
|
112
95
|
if (!match)
|
|
113
96
|
return null;
|
|
114
97
|
const conditionStr = match[1];
|
|
115
98
|
const rest = match[2];
|
|
116
|
-
// Split multiple conditions (shouldn't happen, but handle gracefully)
|
|
117
99
|
const conditions = conditionStr.split(/\s*,\s*/);
|
|
118
100
|
return { conditions, rest };
|
|
119
101
|
}
|
|
120
102
|
function validateCondition(condition) {
|
|
121
|
-
// Date condition: YYYY-MM-DD
|
|
122
103
|
if (/^\d{4}-\d{2}-\d{2}$/.test(condition)) {
|
|
123
104
|
return { type: 'date', value: condition };
|
|
124
105
|
}
|
|
125
|
-
// Package version condition: >=1.0.0, >2.0.0, etc.
|
|
126
106
|
const packageVersionMatch = condition.match(/^([><]=?|=|==)\s*([\d.]+)$/);
|
|
127
107
|
if (packageVersionMatch) {
|
|
128
108
|
return {
|
|
@@ -131,13 +111,11 @@ function validateCondition(condition) {
|
|
|
131
111
|
value: packageVersionMatch[2],
|
|
132
112
|
};
|
|
133
113
|
}
|
|
134
|
-
// Engine version condition: engine:node@>=8, engine:node@>20.0.0
|
|
135
114
|
const engineVersionMatch = condition.match(/^engine:(\w+)@([><]=?)\s*([\d.]+)$/);
|
|
136
115
|
if (engineVersionMatch) {
|
|
137
116
|
const engine = engineVersionMatch[1];
|
|
138
|
-
// Validate engine name
|
|
139
117
|
if (!['node', 'npm', 'yarn', 'pnpm'].includes(engine)) {
|
|
140
|
-
return null;
|
|
118
|
+
return null;
|
|
141
119
|
}
|
|
142
120
|
return {
|
|
143
121
|
type: 'engine-version',
|
|
@@ -145,7 +123,6 @@ function validateCondition(condition) {
|
|
|
145
123
|
operator: engineVersionMatch[2],
|
|
146
124
|
};
|
|
147
125
|
}
|
|
148
|
-
// Dependency condition: +package-name or -package-name
|
|
149
126
|
const depMatch = condition.match(/^([+-])(.+)$/);
|
|
150
127
|
if (depMatch) {
|
|
151
128
|
return {
|
|
@@ -156,10 +133,6 @@ function validateCondition(condition) {
|
|
|
156
133
|
}
|
|
157
134
|
return null;
|
|
158
135
|
}
|
|
159
|
-
/**
|
|
160
|
-
* Evaluate an already-parsed condition. `getPkg` is called lazily so that
|
|
161
|
-
* date-only conditions never touch the filesystem.
|
|
162
|
-
*/
|
|
163
136
|
function checkParsedCondition(getPkg, parsed) {
|
|
164
137
|
if (!parsed)
|
|
165
138
|
return false;
|
|
@@ -241,7 +214,6 @@ exports.expiringTodoComments = (0, eslint_devkit_1.createRule)({
|
|
|
241
214
|
create(context) {
|
|
242
215
|
const [options] = context.options;
|
|
243
216
|
const { terms = ['TODO', 'FIXME', 'XXX'] } = options || {};
|
|
244
|
-
// Cache package.json data
|
|
245
217
|
let packageJson = null;
|
|
246
218
|
function loadPackageJson() {
|
|
247
219
|
if (packageJson !== null) {
|
|
@@ -258,7 +230,6 @@ exports.expiringTodoComments = (0, eslint_devkit_1.createRule)({
|
|
|
258
230
|
if (!parsed)
|
|
259
231
|
continue;
|
|
260
232
|
const { conditions, rest } = parsed;
|
|
261
|
-
// Check for multiple conditions
|
|
262
233
|
if (conditions.length > 1) {
|
|
263
234
|
context.report({
|
|
264
235
|
loc: comment.loc,
|
|
@@ -271,7 +242,6 @@ exports.expiringTodoComments = (0, eslint_devkit_1.createRule)({
|
|
|
271
242
|
continue;
|
|
272
243
|
}
|
|
273
244
|
const condition = conditions[0];
|
|
274
|
-
// Validate condition format
|
|
275
245
|
const parsedCondition = validateCondition(condition);
|
|
276
246
|
if (!parsedCondition) {
|
|
277
247
|
context.report({
|
|
@@ -284,7 +254,6 @@ exports.expiringTodoComments = (0, eslint_devkit_1.createRule)({
|
|
|
284
254
|
});
|
|
285
255
|
continue;
|
|
286
256
|
}
|
|
287
|
-
// Check if condition has expired
|
|
288
257
|
if (checkParsedCondition(loadPackageJson, parsedCondition)) {
|
|
289
258
|
context.report({
|
|
290
259
|
loc: comment.loc,
|
|
@@ -296,7 +265,6 @@ exports.expiringTodoComments = (0, eslint_devkit_1.createRule)({
|
|
|
296
265
|
},
|
|
297
266
|
});
|
|
298
267
|
}
|
|
299
|
-
// Only process one term per comment
|
|
300
268
|
break;
|
|
301
269
|
}
|
|
302
270
|
}
|
|
@@ -313,4 +281,3 @@ exports.expiringTodoComments = (0, eslint_devkit_1.createRule)({
|
|
|
313
281
|
};
|
|
314
282
|
},
|
|
315
283
|
});
|
|
316
|
-
//# sourceMappingURL=expiring-todo-comments.js.map
|