diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c773caded..953590d59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: - pnpm --filter '!*typescript*' build - pnpm --filter '*typescript*' build - pnpm --filter '*vitest*' test:unit - - pnpm --filter '*eslint*' lint --no-fix --max-warnings=0 + - pnpm --filter '*eslint*' --filter '!*nightwatch*' lint --no-fix --max-warnings=0 - pnpm --filter '*prettier*' format --write --check # FIXME: it's failing now # - pnpm --filter '*with-tests*' test:unit diff --git a/__test__/renderEslint.spec.ts b/__test__/renderEslint.spec.ts index d82d2f619..f20f4f6b6 100644 --- a/__test__/renderEslint.spec.ts +++ b/__test__/renderEslint.spec.ts @@ -4,6 +4,7 @@ import { getAdditionalConfigs } from '../utils/renderEslint' describe('renderEslint', () => { it('should get additional dependencies and config with no test flags', () => { const additionalConfigs = getAdditionalConfigs({ + needsTypeScript: false, needsVitest: false, needsCypress: false, needsCypressCT: false, @@ -14,6 +15,7 @@ describe('renderEslint', () => { it('should get additional dependencies and config with for vitest', () => { const additionalConfigs = getAdditionalConfigs({ + needsTypeScript: false, needsVitest: true, needsCypress: false, needsCypressCT: false, @@ -31,6 +33,7 @@ describe('renderEslint', () => { it('should get additional dependencies and config with for cypress', () => { const additionalConfigs = getAdditionalConfigs({ + needsTypeScript: false, needsVitest: false, needsCypress: true, needsCypressCT: false, @@ -53,6 +56,7 @@ describe('renderEslint', () => { it('should get additional dependencies and config with for cypress with component testing', () => { const additionalConfigs = getAdditionalConfigs({ + needsTypeScript: false, needsVitest: false, needsCypress: true, needsCypressCT: true, @@ -76,6 +80,7 @@ describe('renderEslint', () => { it('should get additional dependencies and config with for playwright', () => { const additionalConfigs = getAdditionalConfigs({ + needsTypeScript: false, needsVitest: false, needsCypress: false, needsCypressCT: false, diff --git a/scripts/snapshot.mjs b/scripts/snapshot.mjs index 1b523a0fb..fd1f009f8 100644 --- a/scripts/snapshot.mjs +++ b/scripts/snapshot.mjs @@ -17,6 +17,7 @@ const featureFlags = [ 'cypress', 'playwright', 'nightwatch', + 'eslint', ] const featureFlagsDenylist = [ ['cypress', 'playwright'], @@ -55,7 +56,7 @@ function fullCombination(arr) { } let flagCombinations = fullCombination(featureFlags) -flagCombinations.push(['default'], ['bare', 'default'], ['eslint'], ['eslint-with-prettier']) +flagCombinations.push(['default'], ['bare', 'default'], ['eslint-with-prettier']) // `--with-tests` are equivalent of `--vitest --cypress` // Previously it means `--cypress` without `--vitest`. diff --git a/template/tsconfig/base/tsconfig.node.json b/template/tsconfig/base/tsconfig.node.json index 4c399c2c8..a83dfc9d4 100644 --- a/template/tsconfig/base/tsconfig.node.json +++ b/template/tsconfig/base/tsconfig.node.json @@ -5,7 +5,8 @@ "vitest.config.*", "cypress.config.*", "nightwatch.conf.*", - "playwright.config.*" + "playwright.config.*", + "eslint.config.*" ], "compilerOptions": { "noEmit": true, diff --git a/utils/renderEslint.ts b/utils/renderEslint.ts index a22a222ec..14df806d3 100644 --- a/utils/renderEslint.ts +++ b/utils/renderEslint.ts @@ -22,6 +22,7 @@ export default function renderEslint( }, ) { const additionalConfigs = getAdditionalConfigs({ + needsTypeScript, needsVitest, needsCypress, needsCypressCT, @@ -64,6 +65,7 @@ type AdditionalConfigArray = Array // visible for testing export function getAdditionalConfigs({ + needsTypeScript, needsVitest, needsCypress, needsCypressCT, @@ -96,13 +98,17 @@ export function getAdditionalConfigs({ }, afterVuePlugin: [ { - importer: "import pluginCypress from 'eslint-plugin-cypress/flat'", + importer: + (needsTypeScript + ? `// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n` + + `// @ts-ignore\n` + : '') + "import pluginCypress from 'eslint-plugin-cypress/flat'", content: ` { ...pluginCypress.configs.recommended, files: [ ${[ - ...(needsCypressCT ? ["'**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}',"] : []), + ...(needsCypressCT ? ['**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}'] : []), 'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}', 'cypress/support/**/*.{js,ts,jsx,tsx}', ]