@rotki/eslint-plugin 0.0.3 → 0.2.0
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 +1 -1
- package/dist/index.cjs +625 -0
- package/dist/index.d.cts +96 -0
- package/dist/index.d.mts +96 -0
- package/dist/index.d.ts +84 -17
- package/dist/index.mjs +606 -0
- package/package.json +40 -26
- package/dist/configs/base.d.ts +0 -5
- package/dist/configs/base.js +0 -5
- package/dist/configs/recommended.d.ts +0 -18
- package/dist/configs/recommended.js +0 -18
- package/dist/configs.d.ts +0 -24
- package/dist/configs.js +0 -10
- package/dist/index.js +0 -10
- package/dist/rules/no-deprecated-classes.d.ts +0 -2
- package/dist/rules/no-deprecated-classes.js +0 -97
- package/dist/rules.d.ts +0 -4
- package/dist/rules.js +0 -8
- package/dist/types/eslint.d.ts +0 -212
- package/dist/types/eslint.js +0 -2
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.js +0 -19
- package/dist/types/types.d.ts +0 -38
- package/dist/types/types.js +0 -2
- package/dist/types/vue-parser-services.d.ts +0 -32
- package/dist/types/vue-parser-services.js +0 -2
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -20
- package/dist/utils/rule.d.ts +0 -2
- package/dist/utils/rule.js +0 -7
- package/dist/utils.d.ts +0 -7
- package/dist/utils.js +0 -30
package/dist/configs/base.d.ts
DELETED
package/dist/configs/base.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
extends: string[];
|
|
3
|
-
parserOptions: {
|
|
4
|
-
ecmaVersion: number;
|
|
5
|
-
sourceType: string;
|
|
6
|
-
ecmaFeatures: {
|
|
7
|
-
jsx: boolean;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
env: {
|
|
11
|
-
browser: boolean;
|
|
12
|
-
es6: boolean;
|
|
13
|
-
};
|
|
14
|
-
rules: {
|
|
15
|
-
'@rotki/no-deprecated-classes': "warn";
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export = _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
module.exports = {
|
|
3
|
-
extends: [require.resolve('./base')],
|
|
4
|
-
parserOptions: {
|
|
5
|
-
ecmaVersion: 2022,
|
|
6
|
-
sourceType: 'module',
|
|
7
|
-
ecmaFeatures: {
|
|
8
|
-
jsx: true,
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
env: {
|
|
12
|
-
browser: true,
|
|
13
|
-
es6: true,
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
'@rotki/no-deprecated-classes': 'warn',
|
|
17
|
-
},
|
|
18
|
-
};
|
package/dist/configs.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
base: {
|
|
3
|
-
parser: string;
|
|
4
|
-
plugins: string[];
|
|
5
|
-
};
|
|
6
|
-
recommended: {
|
|
7
|
-
extends: string[];
|
|
8
|
-
parserOptions: {
|
|
9
|
-
ecmaVersion: number;
|
|
10
|
-
sourceType: string;
|
|
11
|
-
ecmaFeatures: {
|
|
12
|
-
jsx: boolean;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
env: {
|
|
16
|
-
browser: boolean;
|
|
17
|
-
es6: boolean;
|
|
18
|
-
};
|
|
19
|
-
rules: {
|
|
20
|
-
'@rotki/no-deprecated-classes': "warn";
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export = _default;
|
package/dist/configs.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const base_1 = __importDefault(require("./configs/base"));
|
|
6
|
-
const recommended_1 = __importDefault(require("./configs/recommended"));
|
|
7
|
-
module.exports = {
|
|
8
|
-
base: base_1.default,
|
|
9
|
-
recommended: recommended_1.default,
|
|
10
|
-
};
|
package/dist/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const configs_1 = __importDefault(require("./configs"));
|
|
6
|
-
const rules_1 = __importDefault(require("./rules"));
|
|
7
|
-
module.exports = {
|
|
8
|
-
configs: configs_1.default,
|
|
9
|
-
rules: rules_1.default,
|
|
10
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const index_1 = require("../utils/index");
|
|
3
|
-
const rule_1 = require("../utils/rule");
|
|
4
|
-
const replacements = [
|
|
5
|
-
['d-block', 'block'],
|
|
6
|
-
['d-flex', 'flex'],
|
|
7
|
-
['flex-column', 'flex-col'],
|
|
8
|
-
['flex-grow-1', 'grow'],
|
|
9
|
-
['flex-grow-0', 'grow-0'],
|
|
10
|
-
['flex-shrink-1', 'shrink'],
|
|
11
|
-
['flex-shrink-0', 'shrink-0'],
|
|
12
|
-
[
|
|
13
|
-
/^align-(start|end|center|baseline|stretch)$/,
|
|
14
|
-
([align]) => `items-${align}`,
|
|
15
|
-
],
|
|
16
|
-
[/^justify-space-(between|around)$/, ([justify]) => `justify-${justify}`],
|
|
17
|
-
[
|
|
18
|
-
/^align-self-(start|end|center|baseline|auto|strech)$/,
|
|
19
|
-
([align]) => `self-${align}`,
|
|
20
|
-
],
|
|
21
|
-
[
|
|
22
|
-
/^font-weight-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)$/,
|
|
23
|
-
([weight]) => `font-${weight}`,
|
|
24
|
-
],
|
|
25
|
-
[/^text-(capitalize|uppercase|lowercase)$/, ([casing]) => casing],
|
|
26
|
-
];
|
|
27
|
-
function isString(replacement) {
|
|
28
|
-
return typeof replacement[0] === 'string';
|
|
29
|
-
}
|
|
30
|
-
function isRegex(replacement) {
|
|
31
|
-
return replacement[0] instanceof RegExp;
|
|
32
|
-
}
|
|
33
|
-
const create = (context) => (0, index_1.defineTemplateBodyVisitor)(context, {
|
|
34
|
-
'VAttribute[key.name="class"]': function (node) {
|
|
35
|
-
if (!node.value || !node.value.value) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const classes = node.value.value.split(/\s+/).filter((s) => !!s);
|
|
39
|
-
const source = context.getSourceCode();
|
|
40
|
-
const replaced = [];
|
|
41
|
-
classes.forEach((className) => {
|
|
42
|
-
for (const replacement of replacements) {
|
|
43
|
-
if (isString(replacement) && replacement[0] === className) {
|
|
44
|
-
replaced.push([className, replacement[1]]);
|
|
45
|
-
}
|
|
46
|
-
if (isRegex(replacement)) {
|
|
47
|
-
const matches = (replacement[0].exec(className) || []).slice(1);
|
|
48
|
-
const replace = replacement[1];
|
|
49
|
-
if (matches.length > 0 && typeof replace === 'function') {
|
|
50
|
-
return replaced.push([className, replace(matches)]);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
replaced.forEach((replacement) => {
|
|
56
|
-
if (!node.value) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const idx = node.value.value.indexOf(replacement[0]) + 1;
|
|
60
|
-
const range = [
|
|
61
|
-
node.value.range[0] + idx,
|
|
62
|
-
node.value.range[0] + idx + replacement[0].length,
|
|
63
|
-
];
|
|
64
|
-
const loc = {
|
|
65
|
-
start: source.getLocFromIndex(range[0]),
|
|
66
|
-
end: source.getLocFromIndex(range[1]),
|
|
67
|
-
};
|
|
68
|
-
context.report({
|
|
69
|
-
loc,
|
|
70
|
-
messageId: 'replacedWith',
|
|
71
|
-
data: {
|
|
72
|
-
a: replacement[0],
|
|
73
|
-
b: replacement[1],
|
|
74
|
-
},
|
|
75
|
-
fix(fixer) {
|
|
76
|
-
return fixer.replaceTextRange(range, replacement[1]);
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
module.exports = (0, rule_1.createRule)({
|
|
83
|
-
meta: {
|
|
84
|
-
type: 'problem',
|
|
85
|
-
docs: {
|
|
86
|
-
description: 'disallow the usage of vuetify css classes since they are replaced with tailwindcss',
|
|
87
|
-
category: 'Recommended',
|
|
88
|
-
url: 'https://rotki.github.io/eslint-plugin/rules/no-deprecated-classes',
|
|
89
|
-
recommended: true,
|
|
90
|
-
},
|
|
91
|
-
messages: {
|
|
92
|
-
replacedWith: `'{{ a }}' has been replaced with '{{ b }}'`,
|
|
93
|
-
},
|
|
94
|
-
fixable: 'code',
|
|
95
|
-
},
|
|
96
|
-
create,
|
|
97
|
-
});
|
package/dist/rules.d.ts
DELETED
package/dist/rules.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const no_deprecated_classes_1 = __importDefault(require("./rules/no-deprecated-classes"));
|
|
6
|
-
module.exports = {
|
|
7
|
-
'no-deprecated-classes': no_deprecated_classes_1.default,
|
|
8
|
-
};
|
package/dist/types/eslint.d.ts
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import type { AST as JSONAST } from 'jsonc-eslint-parser';
|
|
2
|
-
import type { AST as YAMLAST } from 'yaml-eslint-parser';
|
|
3
|
-
import type { AST as VAST } from 'vue-eslint-parser';
|
|
4
|
-
import type { RuleListener, VueParserServices } from './vue-parser-services';
|
|
5
|
-
import type { TokenStore } from './types';
|
|
6
|
-
export interface Position {
|
|
7
|
-
line: number;
|
|
8
|
-
column: number;
|
|
9
|
-
}
|
|
10
|
-
export type Range = [number, number];
|
|
11
|
-
export interface SourceLocation {
|
|
12
|
-
start: Position;
|
|
13
|
-
end: Position;
|
|
14
|
-
}
|
|
15
|
-
export interface MaybeNode {
|
|
16
|
-
type: string;
|
|
17
|
-
range: Range;
|
|
18
|
-
loc: SourceLocation;
|
|
19
|
-
}
|
|
20
|
-
export interface MaybeToken extends MaybeNode {
|
|
21
|
-
value: string;
|
|
22
|
-
}
|
|
23
|
-
export interface RuleContext {
|
|
24
|
-
id: string;
|
|
25
|
-
options: any[];
|
|
26
|
-
settings: object;
|
|
27
|
-
parserPath: string;
|
|
28
|
-
parserServices: {
|
|
29
|
-
isYAML?: true;
|
|
30
|
-
isJSON?: true;
|
|
31
|
-
} & VueParserServices;
|
|
32
|
-
getFilename(): string;
|
|
33
|
-
getSourceCode(): SourceCode;
|
|
34
|
-
getScope(): Scope;
|
|
35
|
-
report(descriptor: ReportDescriptor): void;
|
|
36
|
-
getCwd?: () => string;
|
|
37
|
-
}
|
|
38
|
-
interface ReportDescriptorOptionsBase {
|
|
39
|
-
data?: {
|
|
40
|
-
[key: string]: string;
|
|
41
|
-
};
|
|
42
|
-
fix?: null | ((fixer: RuleFixer) => null | Fix | IterableIterator<Fix> | Fix[]);
|
|
43
|
-
}
|
|
44
|
-
type SuggestionDescriptorMessage = {
|
|
45
|
-
desc: string;
|
|
46
|
-
} | {
|
|
47
|
-
messageId: string;
|
|
48
|
-
};
|
|
49
|
-
export type SuggestionReportDescriptor = SuggestionDescriptorMessage & ReportDescriptorOptionsBase;
|
|
50
|
-
interface ReportDescriptorOptions extends ReportDescriptorOptionsBase {
|
|
51
|
-
suggest?: SuggestionReportDescriptor[] | null;
|
|
52
|
-
}
|
|
53
|
-
type ReportDescriptor = ReportDescriptorMessage & ReportDescriptorLocation & ReportDescriptorOptions;
|
|
54
|
-
type ReportDescriptorMessage = {
|
|
55
|
-
message: string;
|
|
56
|
-
} | {
|
|
57
|
-
messageId: string;
|
|
58
|
-
};
|
|
59
|
-
type ReportDescriptorLocation = {
|
|
60
|
-
node: MaybeNode;
|
|
61
|
-
} | {
|
|
62
|
-
loc: SourceLocation | {
|
|
63
|
-
line: number;
|
|
64
|
-
column: number;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
export interface RuleFixer {
|
|
68
|
-
insertTextAfter(nodeOrToken: MaybeNode, text: string): Fix;
|
|
69
|
-
insertTextAfterRange(range: Range, text: string): Fix;
|
|
70
|
-
insertTextBefore(nodeOrToken: MaybeNode, text: string): Fix;
|
|
71
|
-
insertTextBeforeRange(range: Range, text: string): Fix;
|
|
72
|
-
remove(nodeOrToken: MaybeNode): Fix;
|
|
73
|
-
removeRange(range: Range): Fix;
|
|
74
|
-
replaceText(nodeOrToken: MaybeNode, text: string): Fix;
|
|
75
|
-
replaceTextRange(range: Range, text: string): Fix;
|
|
76
|
-
}
|
|
77
|
-
export interface Fix {
|
|
78
|
-
range: Range;
|
|
79
|
-
text: string;
|
|
80
|
-
}
|
|
81
|
-
export type FilterPredicate = (tokenOrComment: MaybeToken) => boolean;
|
|
82
|
-
export type CursorWithSkipOptions = number | FilterPredicate | {
|
|
83
|
-
includeComments?: boolean;
|
|
84
|
-
filter?: FilterPredicate;
|
|
85
|
-
skip?: number;
|
|
86
|
-
};
|
|
87
|
-
export type CursorWithCountOptions = number | FilterPredicate | {
|
|
88
|
-
includeComments?: boolean;
|
|
89
|
-
filter?: FilterPredicate;
|
|
90
|
-
count?: number;
|
|
91
|
-
};
|
|
92
|
-
export interface SourceCode extends TokenStore {
|
|
93
|
-
text: string;
|
|
94
|
-
ast: VAST.ESLintProgram | JSONAST.JSONProgram | YAMLAST.YAMLProgram;
|
|
95
|
-
lines: string[];
|
|
96
|
-
hasBOM: boolean;
|
|
97
|
-
scopeManager: ScopeManager;
|
|
98
|
-
visitorKeys: VisitorKeys;
|
|
99
|
-
parserServices: {
|
|
100
|
-
isYAML?: true;
|
|
101
|
-
isJSON?: true;
|
|
102
|
-
} & VueParserServices;
|
|
103
|
-
getText(node?: MaybeNode, beforeCount?: number, afterCount?: number): string;
|
|
104
|
-
getLines(): string[];
|
|
105
|
-
getAllComments(): MaybeToken[];
|
|
106
|
-
getComments(node: MaybeNode): {
|
|
107
|
-
leading: MaybeToken[];
|
|
108
|
-
trailing: MaybeToken[];
|
|
109
|
-
};
|
|
110
|
-
getJSDocComment(node: MaybeNode): MaybeToken | null;
|
|
111
|
-
getNodeByRangeIndex(index: number): MaybeNode;
|
|
112
|
-
isSpaceBetweenTokens(first: MaybeToken, second: MaybeToken): boolean;
|
|
113
|
-
getLocFromIndex(index: number): Position;
|
|
114
|
-
getIndexFromLoc(location: Position): number;
|
|
115
|
-
}
|
|
116
|
-
export interface ScopeManager {
|
|
117
|
-
scopes: Scope[];
|
|
118
|
-
globalScope: Scope | null;
|
|
119
|
-
acquire(node: VAST.ESLintNode | VAST.ESLintProgram, inner?: boolean): Scope | null;
|
|
120
|
-
getDeclaredVariables(node: VAST.ESLintNode): Variable[];
|
|
121
|
-
}
|
|
122
|
-
export interface Scope {
|
|
123
|
-
type: 'block' | 'catch' | 'class' | 'for' | 'function' | 'function-expression-name' | 'global' | 'module' | 'switch' | 'with' | 'TDZ';
|
|
124
|
-
isStrict: boolean;
|
|
125
|
-
upper: Scope | null;
|
|
126
|
-
childScopes: Scope[];
|
|
127
|
-
variableScope: Scope;
|
|
128
|
-
block: VAST.ESLintNode;
|
|
129
|
-
variables: Variable[];
|
|
130
|
-
set: Map<string, Variable>;
|
|
131
|
-
references: Reference[];
|
|
132
|
-
through: Reference[];
|
|
133
|
-
functionExpressionScope: boolean;
|
|
134
|
-
}
|
|
135
|
-
export interface Variable {
|
|
136
|
-
name: string;
|
|
137
|
-
identifiers: VAST.ESLintIdentifier[];
|
|
138
|
-
references: Reference[];
|
|
139
|
-
defs: Definition[];
|
|
140
|
-
}
|
|
141
|
-
export interface Reference {
|
|
142
|
-
identifier: VAST.ESLintIdentifier;
|
|
143
|
-
from: Scope;
|
|
144
|
-
resolved: Variable | null;
|
|
145
|
-
writeExpr: VAST.ESLintNode | null;
|
|
146
|
-
init: boolean;
|
|
147
|
-
isWrite(): boolean;
|
|
148
|
-
isRead(): boolean;
|
|
149
|
-
isWriteOnly(): boolean;
|
|
150
|
-
isReadOnly(): boolean;
|
|
151
|
-
isReadWrite(): boolean;
|
|
152
|
-
}
|
|
153
|
-
export type DefinitionType = {
|
|
154
|
-
type: 'CatchClause';
|
|
155
|
-
node: VAST.ESLintCatchClause;
|
|
156
|
-
parent: null;
|
|
157
|
-
} | {
|
|
158
|
-
type: 'ClassName';
|
|
159
|
-
node: VAST.ESLintClassDeclaration | VAST.ESLintClassExpression;
|
|
160
|
-
parent: null;
|
|
161
|
-
} | {
|
|
162
|
-
type: 'FunctionName';
|
|
163
|
-
node: VAST.ESLintFunctionDeclaration | VAST.ESLintFunctionExpression;
|
|
164
|
-
parent: null;
|
|
165
|
-
} | {
|
|
166
|
-
type: 'ImplicitGlobalVariable';
|
|
167
|
-
node: VAST.ESLintProgram;
|
|
168
|
-
parent: null;
|
|
169
|
-
} | {
|
|
170
|
-
type: 'ImportBinding';
|
|
171
|
-
node: VAST.ESLintImportSpecifier | VAST.ESLintImportDefaultSpecifier | VAST.ESLintImportNamespaceSpecifier;
|
|
172
|
-
parent: VAST.ESLintImportDeclaration;
|
|
173
|
-
} | {
|
|
174
|
-
type: 'Parameter';
|
|
175
|
-
node: VAST.ESLintFunctionDeclaration | VAST.ESLintFunctionExpression | VAST.ESLintArrowFunctionExpression;
|
|
176
|
-
parent: null;
|
|
177
|
-
} | {
|
|
178
|
-
type: 'TDZ';
|
|
179
|
-
node: any;
|
|
180
|
-
parent: null;
|
|
181
|
-
} | {
|
|
182
|
-
type: 'Variable';
|
|
183
|
-
node: VAST.ESLintVariableDeclarator;
|
|
184
|
-
parent: VAST.ESLintVariableDeclaration;
|
|
185
|
-
};
|
|
186
|
-
export type Definition = DefinitionType & {
|
|
187
|
-
name: VAST.ESLintIdentifier;
|
|
188
|
-
};
|
|
189
|
-
export interface VisitorKeys {
|
|
190
|
-
[type: string]: string[];
|
|
191
|
-
}
|
|
192
|
-
export type RuleModule = {
|
|
193
|
-
create(context: RuleContext): RuleListener;
|
|
194
|
-
meta: RuleMetaData;
|
|
195
|
-
};
|
|
196
|
-
export interface RuleMetaData {
|
|
197
|
-
docs: {
|
|
198
|
-
description: string;
|
|
199
|
-
category: 'Recommended' | 'Best Practices' | 'Stylistic Issues';
|
|
200
|
-
recommended?: boolean;
|
|
201
|
-
replacedBy?: string[];
|
|
202
|
-
url: string;
|
|
203
|
-
};
|
|
204
|
-
messages?: {
|
|
205
|
-
[messageId: string]: string;
|
|
206
|
-
};
|
|
207
|
-
fixable: 'code' | 'whitespace' | null;
|
|
208
|
-
hasSuggestions?: true;
|
|
209
|
-
deprecated?: boolean;
|
|
210
|
-
type: 'problem' | 'suggestion' | 'layout';
|
|
211
|
-
}
|
|
212
|
-
export {};
|
package/dist/types/eslint.js
DELETED
package/dist/types/index.d.ts
DELETED
package/dist/types/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./eslint"), exports);
|
|
19
|
-
__exportStar(require("./vue-parser-services"), exports);
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { CursorWithCountOptions, CursorWithSkipOptions, MaybeNode, MaybeToken } from './eslint';
|
|
2
|
-
export interface TokenStore {
|
|
3
|
-
getTokenByRangeStart(offset: number, options?: {
|
|
4
|
-
includeComments: boolean;
|
|
5
|
-
}): MaybeToken | null;
|
|
6
|
-
getFirstToken(node: MaybeNode): MaybeToken;
|
|
7
|
-
getFirstToken(node: MaybeNode, options: number): MaybeToken;
|
|
8
|
-
getFirstToken(node: MaybeNode, options: CursorWithSkipOptions): MaybeToken | null;
|
|
9
|
-
getLastToken(node: MaybeNode): MaybeToken;
|
|
10
|
-
getLastToken(node: MaybeNode, options: number): MaybeToken;
|
|
11
|
-
getLastToken(node: MaybeNode, options: CursorWithSkipOptions): MaybeToken | null;
|
|
12
|
-
getTokenBefore(node: MaybeNode): MaybeToken;
|
|
13
|
-
getTokenBefore(node: MaybeNode, options: number): MaybeToken;
|
|
14
|
-
getTokenBefore(node: MaybeNode, options: {
|
|
15
|
-
includeComments: boolean;
|
|
16
|
-
}): MaybeToken;
|
|
17
|
-
getTokenBefore(node: MaybeNode, options: CursorWithSkipOptions): MaybeToken | null;
|
|
18
|
-
getTokenAfter(node: MaybeNode): MaybeToken;
|
|
19
|
-
getTokenAfter(node: MaybeNode, options: number): MaybeToken;
|
|
20
|
-
getTokenAfter(node: MaybeNode, options: {
|
|
21
|
-
includeComments: boolean;
|
|
22
|
-
}): MaybeToken;
|
|
23
|
-
getTokenAfter(node: MaybeNode, options: CursorWithSkipOptions): MaybeToken | null;
|
|
24
|
-
getFirstTokenBetween(left: MaybeNode, right: MaybeNode, options?: CursorWithSkipOptions): MaybeToken | null;
|
|
25
|
-
getLastTokenBetween(left: MaybeNode, right: MaybeNode, options?: CursorWithSkipOptions): MaybeToken | null;
|
|
26
|
-
getFirstTokens(node: MaybeNode, options?: CursorWithCountOptions): MaybeToken[];
|
|
27
|
-
getLastTokens(node: MaybeNode, options?: CursorWithCountOptions): MaybeToken[];
|
|
28
|
-
getTokensBefore(node: MaybeNode, options?: CursorWithCountOptions): MaybeToken[];
|
|
29
|
-
getTokensAfter(node: MaybeNode, options?: CursorWithCountOptions): MaybeToken[];
|
|
30
|
-
getFirstTokensBetween(left: MaybeNode, right: MaybeNode, options?: CursorWithCountOptions): MaybeToken[];
|
|
31
|
-
getLastTokensBetween(left: MaybeNode, right: MaybeNode, options?: CursorWithCountOptions): MaybeToken[];
|
|
32
|
-
getTokens(node: MaybeNode, beforeCount?: CursorWithCountOptions, afterCount?: number): MaybeToken[];
|
|
33
|
-
getTokensBetween(left: MaybeNode, right: MaybeNode, padding?: CursorWithCountOptions): MaybeToken[];
|
|
34
|
-
commentsExistBetween(left: MaybeNode, right: MaybeNode): boolean;
|
|
35
|
-
getCommentsBefore(nodeOrToken: MaybeNode): MaybeToken[];
|
|
36
|
-
getCommentsAfter(nodeOrToken: MaybeNode): MaybeToken[];
|
|
37
|
-
getCommentsInside(node: MaybeNode): MaybeToken[];
|
|
38
|
-
}
|
package/dist/types/types.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import type { RuleContext } from './eslint';
|
|
3
|
-
import type { AST as VAST } from 'vue-eslint-parser';
|
|
4
|
-
import type { TokenStore } from './types';
|
|
5
|
-
import type { VElement } from 'vue-eslint-parser/ast';
|
|
6
|
-
export interface TemplateListener {
|
|
7
|
-
[key: string]: ((node: never) => void) | undefined;
|
|
8
|
-
}
|
|
9
|
-
export interface RuleListener {
|
|
10
|
-
onCodePathStart?(codePath: Rule.CodePath, node: never): void;
|
|
11
|
-
onCodePathEnd?(codePath: Rule.CodePath, node: never): void;
|
|
12
|
-
onCodePathSegmentStart?(segment: Rule.CodePathSegment, node: never): void;
|
|
13
|
-
onCodePathSegmentEnd?(segment: Rule.CodePathSegment, node: never): void;
|
|
14
|
-
onCodePathSegmentLoop?(fromSegment: Rule.CodePathSegment, toSegment: Rule.CodePathSegment, node: never): void;
|
|
15
|
-
[key: string]: ((node: never) => void) | ((codePath: Rule.CodePath, node: never) => void) | ((segment: Rule.CodePathSegment, node: never) => void) | ((fromSegment: Rule.CodePathSegment, toSegment: Rule.CodePathSegment, node: never) => void) | undefined;
|
|
16
|
-
}
|
|
17
|
-
export interface VueParserServices {
|
|
18
|
-
getTemplateBodyTokenStore: () => TokenStore;
|
|
19
|
-
defineTemplateBodyVisitor?: (templateBodyVisitor: TemplateListener, scriptVisitor?: RuleListener) => RuleListener;
|
|
20
|
-
defineCustomBlocksVisitor?: (context: RuleContext, parser: {
|
|
21
|
-
parseForESLint: (code: string, options: any) => any;
|
|
22
|
-
}, rule: {
|
|
23
|
-
target: string | string[] | ((lang: string | null, customBlock: VAST.VElement) => boolean);
|
|
24
|
-
create: CustomBlockVisitorFactory;
|
|
25
|
-
}, scriptVisitor?: RuleListener) => RuleListener;
|
|
26
|
-
getDocumentFragment?: () => VAST.VDocumentFragment | null;
|
|
27
|
-
}
|
|
28
|
-
export type CustomBlockVisitorFactory = (context: RuleContext & {
|
|
29
|
-
parserServices: RuleContext['parserServices'] & {
|
|
30
|
-
customBlock: VElement;
|
|
31
|
-
};
|
|
32
|
-
}) => RuleListener | null;
|
package/dist/utils/index.d.ts
DELETED
package/dist/utils/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineTemplateBodyVisitor = void 0;
|
|
4
|
-
const node_path_1 = require("node:path");
|
|
5
|
-
const UNEXPECTED_ERROR_LOCATION = { line: 1, column: 0 };
|
|
6
|
-
function defineTemplateBodyVisitor(context, templateBodyVisitor, scriptVisitor) {
|
|
7
|
-
const sourceCode = context.getSourceCode();
|
|
8
|
-
if (sourceCode.parserServices.defineTemplateBodyVisitor == null) {
|
|
9
|
-
const filename = context.getFilename();
|
|
10
|
-
if ((0, node_path_1.extname)(filename) === '.vue') {
|
|
11
|
-
context.report({
|
|
12
|
-
loc: UNEXPECTED_ERROR_LOCATION,
|
|
13
|
-
message: 'Use the latest vue-eslint-parser. See also https://github.com/vuejs/eslint-plugin-vue#what-is-the-use-the-latest-vue-eslint-parser-error',
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return {};
|
|
17
|
-
}
|
|
18
|
-
return sourceCode.parserServices.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
19
|
-
}
|
|
20
|
-
exports.defineTemplateBodyVisitor = defineTemplateBodyVisitor;
|
package/dist/utils/rule.d.ts
DELETED
package/dist/utils/rule.js
DELETED
package/dist/utils.d.ts
DELETED
package/dist/utils.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
const index = __importStar(require("./utils/index"));
|
|
26
|
-
const rule = __importStar(require("./utils/rule"));
|
|
27
|
-
module.exports = {
|
|
28
|
-
index,
|
|
29
|
-
rule,
|
|
30
|
-
};
|