Skip to content

Commit

Permalink
chore(deps): update typescript-eslint monorepo to v6 (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinderoubaix authored Sep 3, 2023
1 parent bac770c commit 600ab27
Show file tree
Hide file tree
Showing 21 changed files with 596 additions and 79 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ test-results/
.svelte-kit/
demo/vite-env.d.ts
demo/src/app.d.ts
eslint-plugin/test/file.svelte
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
"sourceType": "module",
"project": ["tsconfig.json"]
},
"plugins": ["@typescript-eslint", "@agnos-ui"],
"overrides": [
Expand Down
2 changes: 1 addition & 1 deletion angular/demo/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"outDir": "../out-tsc/app",
"types": ["@types/webpack-env"]
},
"files": ["src/main.ts", "src/polyfills.ts"],
"files": ["src/main.ts", "src/polyfills.ts", "src/environments/environment.prod.ts"],
"include": ["src/**/*.d.ts", "src/app/samples/**/*.route.ts"]
}
1 change: 0 additions & 1 deletion angular/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "ES2022",
"module": "es2020",
Expand Down
6 changes: 6 additions & 0 deletions base-po/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["../.eslintrc.json"],
"parserOptions": {
"project": ["base-po/tsconfig.json"]
}
}
2 changes: 1 addition & 1 deletion demo/src/lib/stackblitz/angular/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"skipLibCheck": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"moduleResolution": "bundler",
"isolatedModules": true,
"forceConsistentCasingInFileNames": true
}
Expand Down
2 changes: 1 addition & 1 deletion demo/src/lib/stackblitz/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"skipLibCheck": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"moduleResolution": "bundler",
"isolatedModules": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true
Expand Down
2 changes: 1 addition & 1 deletion demo/src/lib/stackblitz/svelte/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"skipLibCheck": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"moduleResolution": "bundler",
"isolatedModules": true,
"forceConsistentCasingInFileNames": true
}
Expand Down
1 change: 0 additions & 1 deletion demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"skipLibCheck": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"forceConsistentCasingInFileNames": true,
Expand Down
3 changes: 2 additions & 1 deletion eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"private": true,
"main": "dist/index.js",
"dependencies": {
"@typescript-eslint/utils": "^5.62.0"
"@typescript-eslint/utils": "^6.4.1"
},
"peerDependencies": {
"typescript": "*"
},
"devDependencies": {
"@angular/core": "^16.2.2",
"@typescript-eslint/rule-tester": "^6.4.1",
"svelte": "^4.2.0",
"svelte-eslint-parser": "^0.33.0"
},
Expand Down
2 changes: 1 addition & 1 deletion eslint-plugin/src/angular-check-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export const angularCheckPropsRule = ESLintUtils.RuleCreator.withoutDocs({
meta: {
docs: {
description: 'Check AgnosUI props in angular components.',
recommended: 'error',
recommended: 'recommended',
},
fixable: 'code',
messages: {
Expand Down
2 changes: 1 addition & 1 deletion eslint-plugin/src/svelte-check-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export const svelteCheckPropsRule = ESLintUtils.RuleCreator.withoutDocs({
meta: {
docs: {
description: 'Check AgnosUI props in svelte components.',
recommended: 'error',
recommended: 'recommended',
},
fixable: 'code',
messages: {
Expand Down
2 changes: 1 addition & 1 deletion eslint-plugin/src/svelte-check-slots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const svelteCheckSlotsRule = ESLintUtils.RuleCreator.withoutDocs({
meta: {
docs: {
description: 'Check AgnosUI calls to Slot in svelte components.',
recommended: 'error',
recommended: 'recommended',
},
fixable: 'code',
messages: {
Expand Down
17 changes: 11 additions & 6 deletions eslint-plugin/test/angular-check-props.spec.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
import {test} from 'vitest';
import {afterAll, describe, test} from 'vitest';
import {angularCheckPropsRule} from '../src/angular-check-props';
import type {TSESLint} from '@typescript-eslint/utils';
import {ESLintUtils} from '@typescript-eslint/utils';
import type {InvalidTestCase} from '@typescript-eslint/rule-tester';
import {RuleTester} from '@typescript-eslint/rule-tester';

test('angular-check-props', () => {
RuleTester.describe = describe;
RuleTester.it = test;
RuleTester.afterAll = afterAll;

describe('angular-check-props', () => {
const codeTemplate = (classContent: string, widgetProps: string, classContent2 = '') =>
`import { Component, EventEmitter } from "@angular/core";\ninterface MyWidgetProps {\n${widgetProps}\n}\ninterface MyWidget {\n\tpatch(props: Partial<MyWidgetProps>): void\n}\n@Component({})\nclass MyComponent {\n${classContent}\n\t_widget: MyWidget;\n${classContent2}\n}`;

const ruleTester = new ESLintUtils.RuleTester({
parser: '@typescript-eslint/parser',
const ruleTester = new RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
project: './tsconfig.test.json',
tsconfigRootDir: __dirname,
},
});
type MessageIds<T extends TSESLint.RuleModule<any, any>> = T extends TSESLint.RuleModule<infer U, any> ? U : never;

const invalid: ESLintUtils.InvalidTestCase<MessageIds<typeof angularCheckPropsRule>, []>[] = [
const invalid: InvalidTestCase<MessageIds<typeof angularCheckPropsRule>, []>[] = [
{
code: codeTemplate('@Input() someInput;', ''),
errors: [{messageId: 'extraProp', data: {type: 'input', name: 'someInput'}}],
Expand Down
17 changes: 11 additions & 6 deletions eslint-plugin/test/svelte-check-props.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import {test} from 'vitest';
import {afterAll, describe, test} from 'vitest';
import {svelteCheckPropsRule} from '../src/svelte-check-props';
import type {TSESLint} from '@typescript-eslint/utils';
import {ESLintUtils} from '@typescript-eslint/utils';
import type {InvalidTestCase} from '@typescript-eslint/rule-tester';
import {RuleTester} from '@typescript-eslint/rule-tester';

test('svelte-check-props', () => {
RuleTester.describe = describe;
RuleTester.it = test;
RuleTester.afterAll = afterAll;

describe('svelte-check-props', () => {
const codeTemplate = (scriptContent: string, widgetProps: string, scriptContent2 = '') =>
`<script lang="ts" context="module">\nimport { createEventDispatcher } from "svelte";\ninterface MyWidgetProps {\n${widgetProps}\n}\ninterface MyWidget {\n\tpatch(props: Partial<MyWidgetProps>): void\n}\n</script><script lang="ts">\nconst dispatch = createEventDispatcher();\n${scriptContent}\nlet widget: MyWidget;\n${scriptContent2}\n</script>`;

const ruleTester = new ESLintUtils.RuleTester({
const ruleTester = new RuleTester({
plugins: ['svelte'],
parser: require.resolve('svelte-eslint-parser') as any,
parser: require.resolve('svelte-eslint-parser'),
parserOptions: {
parser: '@typescript-eslint/parser',
project: './tsconfig.test.json',
Expand All @@ -19,7 +24,7 @@ test('svelte-check-props', () => {
});
type MessageIds<T extends TSESLint.RuleModule<any, any>> = T extends TSESLint.RuleModule<infer U, any> ? U : never;

const invalid: ESLintUtils.InvalidTestCase<MessageIds<typeof svelteCheckPropsRule>, []>[] = [
const invalid: InvalidTestCase<MessageIds<typeof svelteCheckPropsRule>, []>[] = [
{
filename: 'file.svelte',
code: codeTemplate('export let someProp: string | undefined;', ''),
Expand Down
5 changes: 4 additions & 1 deletion eslint-plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "../tsconfig.json"
"extends": "../tsconfig.json",
"compilerOptions": {
"moduleResolution": "bundler"
}
}
Loading

0 comments on commit 600ab27

Please sign in to comment.