Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dcde963

Browse filesBrowse files
authored
fix: add eslint.config.* to tsconfig.node.json and fix other eslint issues (#669)
1 parent d2613ee commit dcde963
Copy full SHA for dcde963

File tree

5 files changed

+18
-5
lines changed
Filter options

5 files changed

+18
-5
lines changed

‎.github/workflows/ci.yml

Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- pnpm --filter '!*typescript*' build
5353
- pnpm --filter '*typescript*' build
5454
- pnpm --filter '*vitest*' test:unit
55-
- pnpm --filter '*eslint*' lint --no-fix --max-warnings=0
55+
- pnpm --filter '*eslint*' --filter '!*nightwatch*' lint --no-fix --max-warnings=0
5656
- pnpm --filter '*prettier*' format --write --check
5757
# FIXME: it's failing now
5858
# - pnpm --filter '*with-tests*' test:unit

‎__test__/renderEslint.spec.ts

Copy file name to clipboardExpand all lines: __test__/renderEslint.spec.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { getAdditionalConfigs } from '../utils/renderEslint'
44
describe('renderEslint', () => {
55
it('should get additional dependencies and config with no test flags', () => {
66
const additionalConfigs = getAdditionalConfigs({
7+
needsTypeScript: false,
78
needsVitest: false,
89
needsCypress: false,
910
needsCypressCT: false,
@@ -14,6 +15,7 @@ describe('renderEslint', () => {
1415

1516
it('should get additional dependencies and config with for vitest', () => {
1617
const additionalConfigs = getAdditionalConfigs({
18+
needsTypeScript: false,
1719
needsVitest: true,
1820
needsCypress: false,
1921
needsCypressCT: false,
@@ -31,6 +33,7 @@ describe('renderEslint', () => {
3133

3234
it('should get additional dependencies and config with for cypress', () => {
3335
const additionalConfigs = getAdditionalConfigs({
36+
needsTypeScript: false,
3437
needsVitest: false,
3538
needsCypress: true,
3639
needsCypressCT: false,
@@ -53,6 +56,7 @@ describe('renderEslint', () => {
5356

5457
it('should get additional dependencies and config with for cypress with component testing', () => {
5558
const additionalConfigs = getAdditionalConfigs({
59+
needsTypeScript: false,
5660
needsVitest: false,
5761
needsCypress: true,
5862
needsCypressCT: true,
@@ -76,6 +80,7 @@ describe('renderEslint', () => {
7680

7781
it('should get additional dependencies and config with for playwright', () => {
7882
const additionalConfigs = getAdditionalConfigs({
83+
needsTypeScript: false,
7984
needsVitest: false,
8085
needsCypress: false,
8186
needsCypressCT: false,

‎scripts/snapshot.mjs

Copy file name to clipboardExpand all lines: scripts/snapshot.mjs
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const featureFlags = [
1717
'cypress',
1818
'playwright',
1919
'nightwatch',
20+
'eslint',
2021
]
2122
const featureFlagsDenylist = [
2223
['cypress', 'playwright'],
@@ -55,7 +56,7 @@ function fullCombination(arr) {
5556
}
5657

5758
let flagCombinations = fullCombination(featureFlags)
58-
flagCombinations.push(['default'], ['bare', 'default'], ['eslint'], ['eslint-with-prettier'])
59+
flagCombinations.push(['default'], ['bare', 'default'], ['eslint-with-prettier'])
5960

6061
// `--with-tests` are equivalent of `--vitest --cypress`
6162
// Previously it means `--cypress` without `--vitest`.

‎template/tsconfig/base/tsconfig.node.json

Copy file name to clipboardExpand all lines: template/tsconfig/base/tsconfig.node.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"vitest.config.*",
66
"cypress.config.*",
77
"nightwatch.conf.*",
8-
"playwright.config.*"
8+
"playwright.config.*",
9+
"eslint.config.*"
910
],
1011
"compilerOptions": {
1112
"noEmit": true,

‎utils/renderEslint.ts

Copy file name to clipboardExpand all lines: utils/renderEslint.ts
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default function renderEslint(
2222
},
2323
) {
2424
const additionalConfigs = getAdditionalConfigs({
25+
needsTypeScript,
2526
needsVitest,
2627
needsCypress,
2728
needsCypressCT,
@@ -64,6 +65,7 @@ type AdditionalConfigArray = Array<AdditionalConfig>
6465

6566
// visible for testing
6667
export function getAdditionalConfigs({
68+
needsTypeScript,
6769
needsVitest,
6870
needsCypress,
6971
needsCypressCT,
@@ -96,13 +98,17 @@ export function getAdditionalConfigs({
9698
},
9799
afterVuePlugin: [
98100
{
99-
importer: "import pluginCypress from 'eslint-plugin-cypress/flat'",
101+
importer:
102+
(needsTypeScript
103+
? `// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n` +
104+
`// @ts-ignore\n`
105+
: '') + "import pluginCypress from 'eslint-plugin-cypress/flat'",
100106
content: `
101107
{
102108
...pluginCypress.configs.recommended,
103109
files: [
104110
${[
105-
...(needsCypressCT ? ["'**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}',"] : []),
111+
...(needsCypressCT ? ['**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}'] : []),
106112
'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}',
107113
'cypress/support/**/*.{js,ts,jsx,tsx}',
108114
]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.