Skip to content

Commit

Permalink
feat: update eslint to v9 (#306)
Browse files Browse the repository at this point in the history
* feat: update vite url

* feat: support ESLint 9 Flat Config

* chore: releasse prep

* test: readd eslint tests

* chore: use single quotes as in the other configs

* chore: bumps to latest esbuild, allowing to remove the type assertion hack

* chore: bumps to latest esbuild, allowing to remove the type assertion hack

* chore(deps): update dependency @vue/eslint-config-typescript to v14 (#304)

* chore(deps): update dependency @vue/eslint-config-typescript to v14

* chore(deps): update all non-major dependencies (#307)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Yordan Ramchev <yordan.ramchev@mentormate.com>

* chore(deps): update dependency chromedriver to ^129.0.3 (#308)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Yordan Ramchev <yordan.ramchev@mentormate.com>

* chore(deps): update dependency @vue/eslint-config-typescript to v14 (#309)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Yordan Ramchev <yordan.ramchev@mentormate.com>

* chore(deps): update dependency eslint to v9 (#310)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore: bump up packages

* feat: add @vitest/eslint-plugin

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
Yordan-Ramchev and renovate[bot] authored Oct 10, 2024
1 parent 5d7c5c8 commit 504a20d
Show file tree
Hide file tree
Showing 9 changed files with 491 additions and 289 deletions.
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"rangeStrategy": "bump",
"labels": ["dependencies"],
"ignoreDeps": ["esbuild", "node"],
"ignoreDeps": ["node"],
"packageRules": [
{
"matchDepNames": ["typescript"],
Expand Down
101 changes: 101 additions & 0 deletions __test__/renderEslint.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { it, describe, expect } from 'vitest'
import { getAdditionalConfigs } from '../utils/renderEslint'

describe('renderEslint', () => {
it('should get additional dependencies and config with no test flags', () => {
const additionalConfigs = getAdditionalConfigs({
needsVitest: false,
needsCypress: false,
needsCypressCT: false,
needsPlaywright: false
})
expect(additionalConfigs).toStrictEqual([])
})

it('should get additional dependencies and config with for vitest', () => {
const additionalConfigs = getAdditionalConfigs({
needsVitest: true,
needsCypress: false,
needsCypressCT: false,
needsPlaywright: false
})
expect(additionalConfigs).toHaveLength(1)
const [additionalVitestConfig] = additionalConfigs
expect(additionalVitestConfig.devDependencies['@vitest/eslint-plugin']).not.toBeUndefined()
expect(additionalVitestConfig.afterVuePlugin).toHaveLength(1)
const [additionalVitestPlugin] = additionalVitestConfig.afterVuePlugin!
expect(additionalVitestPlugin.importer).toBe(`import pluginVitest from '@vitest/eslint-plugin'`)
expect(additionalVitestPlugin.content).toContain('...pluginVitest.configs.recommended')
expect(additionalVitestPlugin.content).toContain("files: ['src/**/__tests__/*']")
})

it('should get additional dependencies and config with for cypress', () => {
const additionalConfigs = getAdditionalConfigs({
needsVitest: false,
needsCypress: true,
needsCypressCT: false,
needsPlaywright: false
})
expect(additionalConfigs).toHaveLength(1)
const [additionalCypressConfig] = additionalConfigs
expect(additionalCypressConfig.devDependencies['eslint-plugin-cypress']).not.toBeUndefined()
expect(additionalCypressConfig.afterVuePlugin).toHaveLength(1)
const [additionalCypressPlugin] = additionalCypressConfig.afterVuePlugin!
expect(additionalCypressPlugin.importer).toBe(
"import pluginCypress from 'eslint-plugin-cypress/flat'"
)
expect(additionalCypressPlugin.content).toContain('...pluginCypress.configs.recommended')
expect(additionalCypressPlugin.content).toContain(
"'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'"
)
expect(additionalCypressPlugin.content).toContain("'cypress/support/**/*.{js,ts,jsx,tsx}'")
})

it('should get additional dependencies and config with for cypress with component testing', () => {
const additionalConfigs = getAdditionalConfigs({
needsVitest: false,
needsCypress: true,
needsCypressCT: true,
needsPlaywright: false
})
expect(additionalConfigs).toHaveLength(1)
const [additionalCypressConfig] = additionalConfigs
expect(additionalCypressConfig.devDependencies['eslint-plugin-cypress']).not.toBeUndefined()
expect(additionalCypressConfig.afterVuePlugin).toHaveLength(1)
const [additionalCypressPlugin] = additionalCypressConfig.afterVuePlugin!
expect(additionalCypressPlugin.importer).toBe(
"import pluginCypress from 'eslint-plugin-cypress/flat'"
)
expect(additionalCypressPlugin.content).toContain('...pluginCypress.configs.recommended')
expect(additionalCypressPlugin.content).toContain("'**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}'")
expect(additionalCypressPlugin.content).toContain(
"'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}'"
)
expect(additionalCypressPlugin.content).toContain("'cypress/support/**/*.{js,ts,jsx,tsx}'")
})

it('should get additional dependencies and config with for playwright', () => {
const additionalConfigs = getAdditionalConfigs({
needsVitest: false,
needsCypress: false,
needsCypressCT: false,
needsPlaywright: true
})
expect(additionalConfigs).toHaveLength(1)
const [additionalPlaywrightConfig] = additionalConfigs
expect(
additionalPlaywrightConfig.devDependencies['eslint-plugin-playwright']
).not.toBeUndefined()
expect(additionalPlaywrightConfig.afterVuePlugin).toHaveLength(1)
const [additionalPlaywrightPlugin] = additionalPlaywrightConfig.afterVuePlugin!
expect(additionalPlaywrightPlugin.importer).toBe(
"import pluginPlaywright from 'eslint-plugin-playwright'"
)
expect(additionalPlaywrightPlugin.content).toContain(
"...pluginPlaywright.configs['flat/recommended']"
)
expect(additionalPlaywrightPlugin.content).toContain(
"files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}']"
)
})
})
Loading

0 comments on commit 504a20d

Please sign in to comment.