Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eslint-plugin): support Eslint 9 and 8 simultaneously #7072

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
33904d7
feat: let eslint-plugin-qwink support Eslint 9 and 8 simultaneously
Nov 19, 2024
93f850e
feat: let eslint-plugin-qwink support Eslint 9 and 8 simultaneously
Nov 19, 2024
83909c4
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 19, 2024
6953229
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 22, 2024
efb017d
support 8 and 9
Nov 22, 2024
f2bdd0d
Merge branch '6048_eslint-flag' of https://github.com/JerryWu1234/qwi…
Nov 22, 2024
5c0723e
upgrade
Nov 22, 2024
0738804
upgrade
Nov 22, 2024
5ed62c5
upgrade
Nov 22, 2024
35ccf83
upgrade
Nov 22, 2024
df6f8f9
Merge branch '6048_eslint-flag' of https://github.com/JerryWu1234/qwi…
Nov 22, 2024
fc3aa53
Update qwik-binding-map.ts
JerryWu1234 Nov 22, 2024
f6d7862
upgrade
Nov 22, 2024
af55f94
upgrade
Nov 22, 2024
64b5c11
upgrade
Nov 22, 2024
cce51f0
upgrade
Nov 22, 2024
20a6fd4
upgrade
Nov 22, 2024
0bda546
upgrade
Nov 22, 2024
02cba46
fix
Nov 22, 2024
5701e52
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 27, 2024
0f75492
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 28, 2024
2458862
fix
Nov 28, 2024
b82a195
Merge branch '6048_eslint-flag' of https://github.com/JerryWu1234/qwi…
Nov 28, 2024
278a5df
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Nov 29, 2024
d378168
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Dec 6, 2024
0dab706
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Dec 10, 2024
fc93083
fix
JerryWu1234 Dec 11, 2024
07427ad
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Dec 11, 2024
13efa82
fix
JerryWu1234 Dec 11, 2024
939f856
Merge branch '6048_eslint-flag' of https://github.com/JerryWu1234/qwi…
JerryWu1234 Dec 11, 2024
13421f3
fix
JerryWu1234 Dec 12, 2024
88efe1b
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Dec 13, 2024
3a5aae2
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Dec 27, 2024
1276d1e
Merge branch 'main' into 6048_eslint-flag
JerryWu1234 Dec 31, 2024
aa1d5fb
fix
Dec 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/breezy-toes-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-qwik': major
---

let eslint-plugin-qwink support Eslint 9 and 8 simultaneously
JerryWu1234 marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 5 additions & 5 deletions packages/eslint-plugin-qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"author": "Builder Team",
"bugs": "https://github.com/QwikDev/qwik/issues",
"dependencies": {
"jsx-ast-utils": "^3.3.5",
"@typescript-eslint/utils": "^8.12.2"
"@typescript-eslint/utils": "^8.12.2",
"jsx-ast-utils": "^3.3.5"
},
"devDependencies": {
"@builder.io/qwik": "workspace:^",
"@builder.io/qwik-city": "workspace:^",
"@types/eslint": "8.56.10",
"@types/eslint": "9.6.1",
"@types/estree": "1.0.5",
"@typescript-eslint/rule-tester": "7.8.0",
"@typescript-eslint/rule-tester": "8.14.0",
"redent": "4.0.0"
},
"engines": {
Expand All @@ -32,7 +32,7 @@
"license": "MIT",
"main": "dist/index.js",
"peerDependencies": {
"eslint": "^8.57.0"
"eslint": "9.15.0"
},
"repository": {
"type": "git",
Expand Down
32 changes: 17 additions & 15 deletions packages/eslint-plugin-qwik/qwik.unit.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as vitest from 'vitest';
// @ts-ignore
import { RuleTester } from '@typescript-eslint/rule-tester';

import { RuleTester, type RuleTesterConfig } from '@typescript-eslint/rule-tester';
import { fileURLToPath } from 'node:url';
import { rules } from './index';
import { readdir, readFile, stat } from 'node:fs/promises';
import { join, dirname } from 'path';
// import {plugin, parser} from 'typescript-eslint'

// https://typescript-eslint.io/packages/rule-tester/#vitest
RuleTester.afterAll = vitest.afterAll;
Expand All @@ -14,22 +14,24 @@ RuleTester.itOnly = vitest.it.only;
RuleTester.describe = vitest.describe;

const testConfig = {
parser: '@typescript-eslint/parser',
env: {
es6: true,
},
parserOptions: {
tsconfigRootDir: fileURLToPath(new URL('.', import.meta.url)),
project: ['./tests/tsconfig.json'],
ecmaFeatures: {
jsx: true,
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ['*.ts*'],
},
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},

ecmaVersion: 2024,
project: ['./tests/tsconfig.json'],
tsconfigRootDir: fileURLToPath(new URL('.', import.meta.url)),
},
ecmaVersion: 2020,
sourceType: 'module',
},
};
} as RuleTesterConfig;

const ruleTester = new RuleTester(testConfig as any);
const ruleTester = new RuleTester(testConfig);
interface TestCase {
name: string;
filename: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin-qwik/tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"incremental": true,
"target": "ES2020",
"module": "ES2020",
"lib": ["es2020", "DOM"],
"target": "ESNext",
"module": "ESNext",
"lib": ["ESNext", "DOM"],
"resolveJsonModule": true,
"jsx": "react-jsx",
"jsxImportSource": "@builder.io/qwik",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const HelloWorld = component$(() => {
class Stuff {}
const stuff = new Stuff();
useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
JerryWu1234 marked this conversation as resolved.
Show resolved Hide resolved
console.log(stuff);
});
return <div></div>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Expect error: { "messageId": "invalidJsxDollar" }
import { component$, useTask$ } from '@builder.io/qwik';
export const HelloWorld = component$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
const click = () => console.log();
return <button onClick$={click}></button>;
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export const HelloWorld = component$(() => {
return 'string';
} else {
return () => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log();
};
}
}
const a = getValue();
useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(a);
});
return <div></div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { component$, useTask$ } from '@builder.io/qwik';
export const HelloWorld = component$(() => {
const a = Symbol();
useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(a);
});
return <div></div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const HelloWorld = component$(() => {
const divRef = useSignal<{ offsetLeft: number }>();

const handleMouseDown = $((e: MouseEvent) => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log('working');
startX = e.pageX - divRef.value!.offsetLeft;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const HelloWorld = component$(() => {
};
const useMethod = getMethod();
useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(useMethod);
});
return <div></div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { component$, useTask$ } from '@builder.io/qwik';

export const HelloWorld = component$(() => {
function useMethod() {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log('stuff');
}
useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(useMethod);
});
return <div></div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default component$(() => {
state.foo = <div>Foo</div>;

useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(state.foo);
});
return <></>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const HelloWorld = component$(() => {
return (
<div
onClick$={() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(a);
}}
></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function getFn(): NoSerialize<() => void> {
export const HelloWorld = component$(() => {
const state: Value = { value: 12, fn: getFn() };
useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(state.value);
});
return <div></div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const HelloWorld = component$(() => {
},
};
useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(useMethod, obj);
});
return <div></div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const HelloWorld = component$(() => {
}
const a = getValue();
useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(a);
});
return <div></div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const HelloWorld = component$(() => {
};
const useMethod = getMethod();
useTask$(() => {
// eslint-disable-next-line no-console
/* eslint no-console: [, { allow: ["log"] }] */
console.log(useMethod);
});
return <div></div>;
Expand Down
Loading
Loading