@studiometa/eslint-plugin-js-toolkit 3.9.0 → 4.0.0-alpha.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/README.md +78 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +2061 -1537
- package/dist/index.js.map +1 -7
- package/package.json +7 -7
- package/dist/rules/async-lifecycle-methods.d.ts +0 -7
- package/dist/rules/components-pascal-case.d.ts +0 -8
- package/dist/rules/emits-kebab-case.d.ts +0 -8
- package/dist/rules/emits-multi-word.d.ts +0 -8
- package/dist/rules/index.d.ts +0 -30
- package/dist/rules/no-create-app.d.ts +0 -7
- package/dist/rules/no-deep-utils-import.d.ts +0 -7
- package/dist/rules/no-deprecated-properties.d.ts +0 -7
- package/dist/rules/no-dispatch-event.d.ts +0 -7
- package/dist/rules/no-dollar-prefix.d.ts +0 -8
- package/dist/rules/no-event-listener-methods.d.ts +0 -7
- package/dist/rules/no-internal-barrel-import.d.ts +0 -7
- package/dist/rules/no-manual-intersection-observer.d.ts +0 -7
- package/dist/rules/no-manual-mutation-observer.d.ts +0 -7
- package/dist/rules/no-redundant-with-mount-when-in-view.d.ts +0 -7
- package/dist/rules/no-shadow-dom.d.ts +0 -7
- package/dist/rules/on-global-handler-prefix.d.ts +0 -7
- package/dist/rules/on-handler-naming.d.ts +0 -7
- package/dist/rules/options-camel-case.d.ts +0 -8
- package/dist/rules/prefer-destructured-lookups.d.ts +0 -8
- package/dist/rules/prefer-ref-over-query-selector.d.ts +0 -7
- package/dist/rules/refs-camel-case.d.ts +0 -8
- package/dist/rules/refs-no-bracket-access.d.ts +0 -7
- package/dist/rules/refs-plural-multiple.d.ts +0 -8
- package/dist/rules/require-children-declared-in-config.d.ts +0 -7
- package/dist/rules/require-config-name-pascal-case.d.ts +0 -8
- package/dist/rules/require-config.d.ts +0 -8
- package/dist/rules/require-destroyed-cleanup.d.ts +0 -12
- package/dist/rules/require-emit-declared-in-config.d.ts +0 -7
- package/dist/rules/require-options-declared-in-config.d.ts +0 -7
- package/dist/rules/require-refs-declared-in-config.d.ts +0 -7
- package/dist/utils/ast.d.ts +0 -51
- package/dist/utils/rule-tester.d.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiometa/eslint-plugin-js-toolkit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"description": "Oxlint/ESLint plugin for @studiometa/js-toolkit best practices",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"build": "node scripts/build.js",
|
|
33
33
|
"test": "vitest run",
|
|
34
34
|
"test:watch": "vitest",
|
|
35
|
-
"lint:types": "
|
|
35
|
+
"lint:types": "tsc -p tsconfig.json"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@vitest/coverage-v8": "4.1.
|
|
39
|
-
"esbuild": "0.27.0",
|
|
38
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
40
39
|
"eslint": "9.34.0",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
40
|
+
"tsdown": "0.22.14",
|
|
41
|
+
"typescript": "7.0.2",
|
|
42
|
+
"vitest": "4.1.10"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@oxlint/plugins": "1.
|
|
45
|
+
"@oxlint/plugins": "1.77.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const componentsPascalCase: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const emitsKebabCase: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const emitsMultiWord: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
package/dist/rules/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export { requireConfig } from './require-config.ts';
|
|
2
|
-
export { requireConfigNamePascalCase } from './require-config-name-pascal-case.ts';
|
|
3
|
-
export { refsCamelCase } from './refs-camel-case.ts';
|
|
4
|
-
export { optionsCamelCase } from './options-camel-case.ts';
|
|
5
|
-
export { asyncLifecycleMethods } from './async-lifecycle-methods.ts';
|
|
6
|
-
export { onHandlerNaming } from './on-handler-naming.ts';
|
|
7
|
-
export { onGlobalHandlerPrefix } from './on-global-handler-prefix.ts';
|
|
8
|
-
export { noDeprecatedProperties } from './no-deprecated-properties.ts';
|
|
9
|
-
export { noDispatchEvent } from './no-dispatch-event.ts';
|
|
10
|
-
export { noShadowDom } from './no-shadow-dom.ts';
|
|
11
|
-
export { noCreateApp } from './no-create-app.ts';
|
|
12
|
-
export { noEventListenerMethods } from './no-event-listener-methods.ts';
|
|
13
|
-
export { refsPluralMultiple } from './refs-plural-multiple.ts';
|
|
14
|
-
export { noDeepUtilsImport } from './no-deep-utils-import.ts';
|
|
15
|
-
export { noInternalBarrelImport } from './no-internal-barrel-import.ts';
|
|
16
|
-
export { refsNoBracketAccess } from './refs-no-bracket-access.ts';
|
|
17
|
-
export { noRedundantWithMountWhenInView } from './no-redundant-with-mount-when-in-view.ts';
|
|
18
|
-
export { preferRefOverQuerySelector } from './prefer-ref-over-query-selector.ts';
|
|
19
|
-
export { requireRefsDeclaredInConfig } from './require-refs-declared-in-config.ts';
|
|
20
|
-
export { noManualIntersectionObserver } from './no-manual-intersection-observer.ts';
|
|
21
|
-
export { noManualMutationObserver } from './no-manual-mutation-observer.ts';
|
|
22
|
-
export { emitsKebabCase } from './emits-kebab-case.ts';
|
|
23
|
-
export { emitsMultiWord } from './emits-multi-word.ts';
|
|
24
|
-
export { componentsPascalCase } from './components-pascal-case.ts';
|
|
25
|
-
export { requireEmitDeclaredInConfig } from './require-emit-declared-in-config.ts';
|
|
26
|
-
export { requireChildrenDeclaredInConfig } from './require-children-declared-in-config.ts';
|
|
27
|
-
export { requireOptionsDeclaredInConfig } from './require-options-declared-in-config.ts';
|
|
28
|
-
export { preferDestructuredLookups } from './prefer-destructured-lookups.ts';
|
|
29
|
-
export { noDollarPrefix } from './no-dollar-prefix.ts';
|
|
30
|
-
export { requireDestroyedCleanup } from './require-destroyed-cleanup.ts';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const noDollarPrefix: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const noRedundantWithMountWhenInView: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
'ClassDeclaration, ClassExpression'(node: Node): void;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const optionsCamelCase: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const preferDestructuredLookups: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
MemberExpression(node: Node): void;
|
|
6
|
-
'MethodDefinition:exit'(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const refsCamelCase: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const refsPluralMultiple: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const requireChildrenDeclaredInConfig: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
'ClassDeclaration, ClassExpression'(classNode: Node): void;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const requireConfigNamePascalCase: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const requireConfig: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const requireDestroyedCleanup: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
ClassDeclaration(node: Node): void;
|
|
6
|
-
ClassExpression(node: Node): void;
|
|
7
|
-
MethodDefinition(node: Node): void;
|
|
8
|
-
CallExpression(node: Node): void;
|
|
9
|
-
'ClassDeclaration:exit'(node: Node): void;
|
|
10
|
-
'ClassExpression:exit'(node: Node): void;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const requireEmitDeclaredInConfig: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
'ClassDeclaration, ClassExpression'(classNode: Node): void;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const requireOptionsDeclaredInConfig: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
'ClassDeclaration, ClassExpression'(classNode: Node): void;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Node, type RuleContext } from '../utils/ast.ts';
|
|
2
|
-
export declare const requireRefsDeclaredInConfig: {
|
|
3
|
-
meta?: import("../utils/ast.ts").RuleMeta;
|
|
4
|
-
createOnce(context: RuleContext): {
|
|
5
|
-
'ClassDeclaration, ClassExpression'(classNode: Node): void;
|
|
6
|
-
};
|
|
7
|
-
};
|
package/dist/utils/ast.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ESLint v9 compatible AST node types used across rules.
|
|
3
|
-
* We use loose typings here since oxlint/eslint expose their own node types.
|
|
4
|
-
*/
|
|
5
|
-
export type Node = Record<string, any>;
|
|
6
|
-
export type RuleContext = Record<string, any>;
|
|
7
|
-
export type RuleMeta = {
|
|
8
|
-
type?: 'problem' | 'suggestion' | 'layout';
|
|
9
|
-
fixable?: 'code' | 'whitespace';
|
|
10
|
-
hasSuggestions?: boolean;
|
|
11
|
-
docs?: {
|
|
12
|
-
description?: string;
|
|
13
|
-
};
|
|
14
|
-
messages?: Record<string, string>;
|
|
15
|
-
};
|
|
16
|
-
export declare function createRule<V extends Record<string, (node: Node) => unknown>>(rule: {
|
|
17
|
-
meta?: RuleMeta;
|
|
18
|
-
createOnce(context: RuleContext): V;
|
|
19
|
-
}): {
|
|
20
|
-
meta?: RuleMeta;
|
|
21
|
-
createOnce(context: RuleContext): V;
|
|
22
|
-
};
|
|
23
|
-
export declare const LIFECYCLE_METHODS: Set<string>;
|
|
24
|
-
export declare const TOOLKIT_PACKAGE = "@studiometa/js-toolkit";
|
|
25
|
-
/**
|
|
26
|
-
* Returns true if a class declaration extends an identifier imported from
|
|
27
|
-
* @studiometa/js-toolkit, or extends a bare identifier named `Base`.
|
|
28
|
-
*
|
|
29
|
-
* This is a heuristic — we cannot do full type resolution in a lint rule.
|
|
30
|
-
*/
|
|
31
|
-
export declare function isBaseSubclass(node: Node, context: RuleContext): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Returns true if the string is camelCase (starts lowercase, no separators).
|
|
34
|
-
*/
|
|
35
|
-
export declare function isCamelCase(value: string): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Returns true if the string is PascalCase.
|
|
38
|
-
*/
|
|
39
|
-
export declare function isPascalCase(value: string): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Converts a kebab-case, snake_case or PascalCase string to camelCase.
|
|
42
|
-
*/
|
|
43
|
-
export declare function toCamelCase(value: string): string;
|
|
44
|
-
/**
|
|
45
|
-
* Converts a kebab-case, snake_case or camelCase string to PascalCase.
|
|
46
|
-
*/
|
|
47
|
-
export declare function toPascalCase(value: string): string;
|
|
48
|
-
/**
|
|
49
|
-
* Walks up ancestor nodes to find the nearest class declaration/expression.
|
|
50
|
-
*/
|
|
51
|
-
export declare function findEnclosingClass(ancestors: Node[]): Node | null;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { RuleTester } from 'eslint';
|
|
2
|
-
import { eslintCompatPlugin } from '@oxlint/plugins';
|
|
3
|
-
export { RuleTester };
|
|
4
|
-
export declare const tester: {
|
|
5
|
-
run(name: string, rule: Parameters<typeof eslintCompatPlugin>[0]["rules"][string], tests: Parameters<InstanceType<typeof RuleTester>["run"]>[2]): void;
|
|
6
|
-
};
|