Skip to content

Commit e5f2619

Browse files
authored
chore: update dev deps and fix lint errors (#380)
* chore: update dev deps and fix lint errors * downgrade vue-eslint-parser
1 parent a7a54b5 commit e5f2619

File tree

10 files changed

+92
-125
lines changed

10 files changed

+92
-125
lines changed

docs/.vitepress/theme/components/components/EslintPluginEditor.vue

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ import { rules } from "../../../../../src/utils/rules";
2424
export default {
2525
name: "EslintPluginEditor",
2626
components: { EslintEditor },
27-
model: {
28-
prop: "code",
29-
},
3027
props: {
3128
code: {
3229
type: String,

eslint.config.mjs

+37-43
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
import tsParser from "@typescript-eslint/parser";
2-
import path from "node:path";
3-
import { fileURLToPath } from "node:url";
4-
import js from "@eslint/js";
5-
import { FlatCompat } from "@eslint/eslintrc";
6-
7-
const __filename = fileURLToPath(import.meta.url);
8-
const __dirname = path.dirname(__filename);
9-
const compat = new FlatCompat({
10-
baseDirectory: __dirname,
11-
recommendedConfig: js.configs.recommended,
12-
allConfig: js.configs.all,
13-
});
2+
import myPlugin from "@ota-meshi/eslint-plugin";
3+
import tseslint from "typescript-eslint";
144

155
export default [
166
{
@@ -33,19 +23,18 @@ export default [
3323
"**/*.md/*.bash",
3424
],
3525
},
36-
...compat.extends(
37-
"plugin:@ota-meshi/recommended",
38-
"plugin:@ota-meshi/+node",
39-
"plugin:@ota-meshi/+typescript",
40-
"plugin:@ota-meshi/+eslint-plugin",
41-
"plugin:@ota-meshi/+vue3",
42-
"plugin:@ota-meshi/+package-json",
43-
"plugin:@ota-meshi/+json",
44-
"plugin:@ota-meshi/+yaml",
45-
"plugin:@ota-meshi/+toml",
46-
"plugin:@ota-meshi/+md",
47-
"plugin:@ota-meshi/+prettier",
48-
),
26+
...myPlugin.config({
27+
node: true,
28+
ts: true,
29+
eslintPlugin: true,
30+
vue3: true,
31+
packageJson: true,
32+
json: true,
33+
yaml: true,
34+
toml: true,
35+
md: true,
36+
prettier: true,
37+
}),
4938
{
5039
languageOptions: {
5140
ecmaVersion: "latest",
@@ -181,13 +170,14 @@ export default [
181170
"@typescript-eslint/no-non-null-assertion": "off",
182171
},
183172
},
184-
{
173+
...tseslint.config({
185174
files: ["tests/fixtures/**"],
186-
175+
extends: [tseslint.configs.disableTypeChecked],
187176
rules: {
188177
"json-schema-validator/no-invalid": "off",
178+
"jsonc/vue-custom-block/no-parsing-error": "off",
189179
},
190-
},
180+
}),
191181
{
192182
files: ["scripts/**/*.ts", "tests/**/*.ts"],
193183

@@ -216,18 +206,16 @@ export default [
216206
sourceType: "module",
217207
},
218208
},
219-
...compat
220-
.extends("plugin:@typescript-eslint/disable-type-checked")
221-
.map((config) => ({
222-
...config,
223-
files: ["docs/.vitepress/**/*.", "docs/.vitepress/*."].flatMap((s) => [
224-
`${s}js`,
225-
`${s}mjs`,
226-
`${s}ts`,
227-
`${s}mts`,
228-
`${s}vue`,
229-
]),
230-
})),
209+
...tseslint.config({
210+
files: ["docs/.vitepress/**/*.", "docs/.vitepress/*."].flatMap((s) => [
211+
`${s}js`,
212+
`${s}mjs`,
213+
`${s}ts`,
214+
`${s}mts`,
215+
`${s}vue`,
216+
]),
217+
extends: [tseslint.configs.disableTypeChecked],
218+
}),
231219
{
232220
files: ["docs/.vitepress/**/*.", "docs/.vitepress/*."].flatMap((s) => [
233221
`${s}js`,
@@ -258,6 +246,7 @@ export default [
258246
"n/no-extraneous-import": "off",
259247
"n/file-extension-in-import": "off",
260248
"n/no-unsupported-features/node-builtins": "off",
249+
"@typescript-eslint/explicit-module-boundary-types": "off",
261250
},
262251
},
263252
{
@@ -266,15 +255,20 @@ export default [
266255
sourceType: "module",
267256
},
268257
},
269-
{
270-
files: ["*.md/*.js", "**/*.md/*.js"],
258+
...tseslint.config({
259+
files: ["*.md/*.js", "**/*.md/*.js", "**/*.md/*.vue"],
260+
extends: [tseslint.configs.disableTypeChecked],
271261
languageOptions: {
272262
sourceType: "module",
273263
},
274264
rules: {
275265
"n/no-missing-import": "off",
276266
},
277-
},
267+
}),
268+
...tseslint.config({
269+
files: ["**/*.md"],
270+
extends: [tseslint.configs.disableTypeChecked],
271+
}),
278272
{
279273
files: ["**/*.toml"],
280274
rules: {

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"eslint-plugin-prettier": "^5.0.0",
100100
"eslint-plugin-regexp": "^2.0.0",
101101
"eslint-plugin-toml": "^0.12.0",
102-
"eslint-plugin-vue": "^9.0.0",
102+
"eslint-plugin-vue": "^10.0.0",
103103
"eslint-plugin-yml": "^1.0.0",
104104
"events": "^3.3.0",
105105
"mocha": "^11.0.0",
@@ -116,9 +116,10 @@
116116
"stylelint-config-standard-vue": "^1.0.0",
117117
"stylelint-stylus": "^1.0.0",
118118
"typescript": "^5.0.0",
119+
"typescript-eslint": "^8.29.0",
119120
"vite-plugin-eslint4b": "^0.5.0",
120121
"vitepress": "^1.0.1",
121-
"vue-eslint-parser": "^9.0.0",
122+
"vue-eslint-parser": "^9.4.3",
122123
"yaml": "^2.1.1"
123124
},
124125
"publishConfig": {

src/rules/no-invalid.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ import {
1717
import { loadJson, loadSchema } from "../utils/schema";
1818
import type { RuleContext } from "../types";
1919
import type { NodeData } from "../utils/ast/common";
20-
import type {
21-
ESLintAssignmentExpression,
22-
ESLintExportDefaultDeclaration,
23-
ESLintExpression,
24-
// eslint-disable-next-line n/no-missing-import -- d.ts
25-
} from "vue-eslint-parser/ast";
20+
import type { AST } from "vue-eslint-parser";
2621
import type { ValidateError, Validator } from "../utils/validator-factory";
2722
import { compile } from "../utils/validator-factory";
2823
import type { SchemaObject } from "../utils/types";
@@ -204,7 +199,7 @@ export default createRule("no-invalid", {
204199
* Validate JS Object
205200
*/
206201
function validateJSExport(
207-
node: ESLintExpression,
202+
node: AST.ESLintExpression,
208203
rootRange: [number, number],
209204
) {
210205
if (existsExports) {
@@ -274,7 +269,7 @@ export default createRule("no-invalid", {
274269
});
275270
}
276271
},
277-
ExportDefaultDeclaration(node: ESLintExportDefaultDeclaration) {
272+
ExportDefaultDeclaration(node: AST.ESLintExportDefaultDeclaration) {
278273
if (
279274
node.declaration.type === "FunctionDeclaration" ||
280275
node.declaration.type === "ClassDeclaration" ||
@@ -288,7 +283,7 @@ export default createRule("no-invalid", {
288283
defaultToken.range![1],
289284
]);
290285
},
291-
AssignmentExpression(node: ESLintAssignmentExpression) {
286+
AssignmentExpression(node: AST.ESLintAssignmentExpression) {
292287
if (
293288
// exports = {}
294289
(node.left.type === "Identifier" && node.left.name === "exports") ||

src/types.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { AST as YAML } from "yaml-eslint-parser";
66
import type { AST as TOML } from "toml-eslint-parser";
77
import type { AST as ES, Scope } from "eslint";
88
import type { Comment as ESTreeComment } from "estree";
9-
import type { ESLintNode, VElement } from "vue-eslint-parser/ast";
9+
import type { AST } from "vue-eslint-parser";
1010
export interface RuleListener {
1111
[key: string]: ((node: never) => void) | undefined;
1212
}
@@ -73,7 +73,7 @@ export interface RuleContext {
7373
isJSON?: true;
7474
isYAML?: true;
7575
isTOML?: true;
76-
customBlock?: VElement;
76+
customBlock?: AST.VElement;
7777
};
7878
getAncestors(): Node[];
7979
getFilename(): string;
@@ -88,7 +88,11 @@ export interface RuleContext {
8888
export declare namespace SourceCode {
8989
export function splitLines(text: string): string[];
9090
}
91-
export type Node = ESLintNode | JSON.JSONNode | YAML.YAMLNode | TOML.TOMLNode;
91+
export type Node =
92+
| AST.ESLintNode
93+
| JSON.JSONNode
94+
| YAML.YAMLNode
95+
| TOML.TOMLNode;
9296
export type Token = ES.Token | YAML.Token | TOML.Token | Comment;
9397
export type Comment = ESTreeComment | YAML.Comment | TOML.Comment;
9498
export type NodeOrToken = Node | Token;

0 commit comments

Comments
 (0)