Skip to content

Commit 10197ef

Browse files
committed
fix(cypress): apply workaround to avoid Vue TS eslint overrides
1 parent cdae0a5 commit 10197ef

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

test-vite-app-v2/eslint.config.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import pluginCypress from 'eslint-plugin-cypress/flat';
99
import pluginVue from 'eslint-plugin-vue';
1010
import globals from 'globals';
1111

12-
export default defineConfigWithVueTs(
12+
const config = defineConfigWithVueTs(
1313
{
1414
/**
1515
* Ignore the following files.
@@ -116,3 +116,21 @@ export default defineConfigWithVueTs(
116116
},
117117
},
118118
);
119+
120+
// FIXME: quick-fix due to Vue plugin disabling these rules without allowing for a way to customize them
121+
// We're waiting for an answer from the Vue team, because type-aware linting rules are automatically extracted by them and injected before
122+
// the TS plugin parser configuration, in order to be able to apply them to Vue files.
123+
// See https://github.com/vuejs/eslint-config-typescript/blob/e5b983369bee342e3fb0d9141138c5d5a80e6949/src/internals.ts#L133-L145
124+
// See https://github.com/vuejs/eslint-config-typescript/blob/e5b983369bee342e3fb0d9141138c5d5a80e6949/src/utilities.ts#L196-L208
125+
config.push({
126+
files: ['test/cypress/**/*.{js,jsx,ts,tsx}', '**/*.cy.{js,jsx,ts,tsx}'],
127+
rules: {
128+
'@typescript-eslint/no-unsafe-argument': 'error',
129+
'@typescript-eslint/no-unsafe-assignment': 'error',
130+
'@typescript-eslint/no-unsafe-call': 'error',
131+
'@typescript-eslint/no-unsafe-member-access': 'error',
132+
'@typescript-eslint/no-unsafe-return': 'error',
133+
}
134+
});
135+
136+
export default config;

test-vite-app-v2/src/components/__tests__/VModelComponent.cy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ describe('VModelComponent', () => {
5353
const model = ref('Quasar');
5454

5555
cy.mount(VModelComponent, {
56+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
5657
props: {
5758
...vModelAdapter(model),
5859
},

test-webpack-app-v4/eslint.config.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import prettierSkipFormatting from '@vue/eslint-config-prettier/skip-formatting';
1010
import pluginCypress from 'eslint-plugin-cypress/flat';
1111

12-
export default defineConfigWithVueTs(
12+
const config = defineConfigWithVueTs(
1313
{
1414
/**
1515
* Ignore the following files.
@@ -104,3 +104,21 @@ export default defineConfigWithVueTs(
104104
},
105105
},
106106
);
107+
108+
// FIXME: quick-fix due to Vue plugin disabling these rules without allowing for a way to customize them
109+
// We're waiting for an answer from the Vue team, because type-aware linting rules are automatically extracted by them and injected before
110+
// the TS plugin parser configuration, in order to be able to apply them to Vue files.
111+
// See https://github.com/vuejs/eslint-config-typescript/blob/e5b983369bee342e3fb0d9141138c5d5a80e6949/src/internals.ts#L133-L145
112+
// See https://github.com/vuejs/eslint-config-typescript/blob/e5b983369bee342e3fb0d9141138c5d5a80e6949/src/utilities.ts#L196-L208
113+
config.push({
114+
files: ['test/cypress/**/*.{js,jsx,ts,tsx}', '**/*.cy.{js,jsx,ts,tsx}'],
115+
rules: {
116+
'@typescript-eslint/no-unsafe-argument': 'error',
117+
'@typescript-eslint/no-unsafe-assignment': 'error',
118+
'@typescript-eslint/no-unsafe-call': 'error',
119+
'@typescript-eslint/no-unsafe-member-access': 'error',
120+
'@typescript-eslint/no-unsafe-return': 'error',
121+
}
122+
});
123+
124+
export default config;

0 commit comments

Comments
 (0)