mirror of
https://github.com/IT4Change/boilerplate-e2e-cypress-cucumber.git
synced 2025-12-13 04:55:50 +00:00
eslint: migrate to v9
This commit is contained in:
parent
de668cddf3
commit
c7f4918ac2
@ -1,4 +0,0 @@
|
|||||||
build/
|
|
||||||
cypress/reports/
|
|
||||||
cypress/screenshots/
|
|
||||||
node_modules/
|
|
||||||
173
.eslintrc.cjs
173
.eslintrc.cjs
@ -1,173 +0,0 @@
|
|||||||
// eslint-disable-next-line import/no-commonjs
|
|
||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2021: true,
|
|
||||||
},
|
|
||||||
extends: [
|
|
||||||
'standard',
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:@eslint-community/eslint-comments/recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'plugin:import/recommended',
|
|
||||||
'plugin:import/typescript',
|
|
||||||
'plugin:security/recommended-legacy',
|
|
||||||
],
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: 'latest',
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
|
||||||
plugins: ['cypress', '@typescript-eslint', 'import'],
|
|
||||||
settings: {
|
|
||||||
'import/resolver': {
|
|
||||||
typescript: true,
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
'no-console': 'error',
|
|
||||||
'no-debugger': 'error',
|
|
||||||
camelcase: 'error',
|
|
||||||
indent: ['error', 2],
|
|
||||||
'linebreak-style': ['error', 'unix'],
|
|
||||||
semi: ['error', 'never'],
|
|
||||||
// Optional eslint-comments rule
|
|
||||||
'@eslint-community/eslint-comments/no-unused-disable': 'error',
|
|
||||||
'@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
|
|
||||||
// cypress
|
|
||||||
'cypress/no-assigning-return-values': 'error',
|
|
||||||
'cypress/no-unnecessary-waiting': 'error',
|
|
||||||
'cypress/assertion-before-screenshot': 'warn',
|
|
||||||
'cypress/no-force': 'warn',
|
|
||||||
'cypress/no-async-tests': 'error',
|
|
||||||
'cypress/no-pause': 'error',
|
|
||||||
// import
|
|
||||||
'import/export': 'error',
|
|
||||||
'import/no-deprecated': 'error',
|
|
||||||
'import/no-empty-named-blocks': 'error',
|
|
||||||
'import/no-extraneous-dependencies': 'error',
|
|
||||||
'import/no-mutable-exports': 'error',
|
|
||||||
'import/no-unused-modules': 'error',
|
|
||||||
'import/no-named-as-default': 'error',
|
|
||||||
'import/no-named-as-default-member': 'error',
|
|
||||||
'import/no-amd': 'error',
|
|
||||||
'import/no-commonjs': 'error',
|
|
||||||
'import/no-import-module-exports': 'error',
|
|
||||||
'import/no-nodejs-modules': 'off',
|
|
||||||
'import/unambiguous': 'off',
|
|
||||||
'import/default': 'error',
|
|
||||||
'import/named': 'error',
|
|
||||||
'import/namespace': 'error',
|
|
||||||
'import/no-absolute-path': 'error',
|
|
||||||
'import/no-cycle': 'error',
|
|
||||||
'import/no-dynamic-require': 'error',
|
|
||||||
'import/no-internal-modules': 'off',
|
|
||||||
'import/no-relative-packages': 'error',
|
|
||||||
'import/no-relative-parent-imports': [
|
|
||||||
'error',
|
|
||||||
{ ignore: ['#[src,root,components,pages,assets,layouts,stores,plugins,context,types]/*'] },
|
|
||||||
],
|
|
||||||
'import/no-self-import': 'error',
|
|
||||||
'import/no-unresolved': 'error',
|
|
||||||
'import/no-useless-path-segments': 'error',
|
|
||||||
'import/no-webpack-loader-syntax': 'error',
|
|
||||||
'import/consistent-type-specifier-style': 'error',
|
|
||||||
'import/exports-last': 'off',
|
|
||||||
'import/extensions': [
|
|
||||||
'error',
|
|
||||||
'never',
|
|
||||||
{
|
|
||||||
json: 'always',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'import/first': 'error',
|
|
||||||
'import/group-exports': 'off',
|
|
||||||
'import/newline-after-import': 'error',
|
|
||||||
'import/no-anonymous-default-export': 'off', // todo - consider to enable again
|
|
||||||
'import/no-default-export': 'off',
|
|
||||||
'import/no-duplicates': 'error',
|
|
||||||
'import/no-named-default': 'error',
|
|
||||||
'import/no-namespace': 'error',
|
|
||||||
'import/no-unassigned-import': 'error',
|
|
||||||
'import/order': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
|
||||||
'newlines-between': 'always',
|
|
||||||
alphabetize: {
|
|
||||||
order: 'asc', // sort in ascending order. Options: ["ignore", "asc", "desc"]
|
|
||||||
caseInsensitive: true, // ignore case. Options: [true, false]
|
|
||||||
},
|
|
||||||
distinctGroup: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'import/prefer-default-export': 'off',
|
|
||||||
// promise
|
|
||||||
'promise/catch-or-return': 'error',
|
|
||||||
'promise/no-return-wrap': 'error',
|
|
||||||
'promise/param-names': 'error',
|
|
||||||
'promise/always-return': 'error',
|
|
||||||
'promise/no-native': 'off',
|
|
||||||
'promise/no-nesting': 'warn',
|
|
||||||
'promise/no-promise-in-callback': 'warn',
|
|
||||||
'promise/no-callback-in-promise': 'warn',
|
|
||||||
'promise/avoid-new': 'warn',
|
|
||||||
'promise/no-new-statics': 'error',
|
|
||||||
'promise/no-return-in-finally': 'warn',
|
|
||||||
'promise/valid-params': 'warn',
|
|
||||||
'promise/prefer-await-to-callbacks': 'error',
|
|
||||||
'promise/no-multiple-resolved': 'error',
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ['*.ts', '*.tsx'],
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
parserOptions: {
|
|
||||||
tsconfigRootDir: __dirname,
|
|
||||||
project: ['./tsconfig.json', '**/tsconfig.json'],
|
|
||||||
ecmaVersion: 'latest',
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
|
||||||
plugins: ['@typescript-eslint'],
|
|
||||||
extends: [
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
||||||
'plugin:@typescript-eslint/strict',
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
// allow explicitly defined dangling promises
|
|
||||||
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
|
|
||||||
'no-void': ['error', { allowAsStatement: true }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ['!*.json'],
|
|
||||||
plugins: ['prettier'],
|
|
||||||
extends: ['plugin:prettier/recommended'],
|
|
||||||
rules: {
|
|
||||||
'prettier/prettier': 'error',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ['!*.json'],
|
|
||||||
plugins: ['prettier'],
|
|
||||||
extends: ['plugin:prettier/recommended'],
|
|
||||||
rules: {
|
|
||||||
'prettier/prettier': 'error',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ['*.json'],
|
|
||||||
plugins: ['json'],
|
|
||||||
extends: ['plugin:json/recommended-with-comments'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ['*.yaml', '*.yml'],
|
|
||||||
parser: 'yaml-eslint-parser',
|
|
||||||
plugins: ['yml'],
|
|
||||||
extends: ['plugin:yml/prettier'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
262
eslint.config.cjs
Normal file
262
eslint.config.cjs
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
const { fixupConfigRules, fixupPluginRules } = require('@eslint/compat')
|
||||||
|
const { FlatCompat } = require('@eslint/eslintrc')
|
||||||
|
const js = require('@eslint/js')
|
||||||
|
const typescriptEslint = require('@typescript-eslint/eslint-plugin')
|
||||||
|
const tsParser = require('@typescript-eslint/parser')
|
||||||
|
const { defineConfig, globalIgnores } = require('eslint/config')
|
||||||
|
const cypress = require('eslint-plugin-cypress')
|
||||||
|
const _import = require('eslint-plugin-import')
|
||||||
|
const json = require('eslint-plugin-json')
|
||||||
|
const prettier = require('eslint-plugin-prettier')
|
||||||
|
const yml = require('eslint-plugin-yml')
|
||||||
|
const globals = require('globals')
|
||||||
|
const parser = require('yaml-eslint-parser')
|
||||||
|
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
|
allConfig: js.configs.all,
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = defineConfig([
|
||||||
|
{
|
||||||
|
ignores: ['build/*', 'cypress/reports/*', 'cypress/screenshots/*', 'node_modules/*'],
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
},
|
||||||
|
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
sourceType: 'module',
|
||||||
|
|
||||||
|
parserOptions: {
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
extends: fixupConfigRules(
|
||||||
|
compat.extends(
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:@eslint-community/eslint-comments/recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:import/recommended',
|
||||||
|
'plugin:import/typescript',
|
||||||
|
'plugin:security/recommended-legacy',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
cypress,
|
||||||
|
'@typescript-eslint': fixupPluginRules(typescriptEslint),
|
||||||
|
import: fixupPluginRules(_import),
|
||||||
|
},
|
||||||
|
|
||||||
|
settings: {
|
||||||
|
'import/resolver': {
|
||||||
|
typescript: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'no-console': 'error',
|
||||||
|
'no-debugger': 'error',
|
||||||
|
camelcase: 'error',
|
||||||
|
indent: ['error', 2],
|
||||||
|
'linebreak-style': ['error', 'unix'],
|
||||||
|
semi: ['error', 'never'],
|
||||||
|
'@eslint-community/eslint-comments/no-unused-disable': 'error',
|
||||||
|
'@eslint-community/eslint-comments/disable-enable-pair': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
allowWholeFile: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'cypress/no-assigning-return-values': 'error',
|
||||||
|
'cypress/no-unnecessary-waiting': 'error',
|
||||||
|
'cypress/assertion-before-screenshot': 'warn',
|
||||||
|
'cypress/no-force': 'warn',
|
||||||
|
'cypress/no-async-tests': 'error',
|
||||||
|
'cypress/no-pause': 'error',
|
||||||
|
'import/export': 'error',
|
||||||
|
'import/no-deprecated': 'error',
|
||||||
|
'import/no-empty-named-blocks': 'error',
|
||||||
|
'import/no-extraneous-dependencies': 'error',
|
||||||
|
'import/no-mutable-exports': 'error',
|
||||||
|
'import/no-unused-modules': 'error',
|
||||||
|
'import/no-named-as-default': 'error',
|
||||||
|
'import/no-named-as-default-member': 'error',
|
||||||
|
'import/no-amd': 'error',
|
||||||
|
'import/no-commonjs': 'error',
|
||||||
|
'import/no-import-module-exports': 'error',
|
||||||
|
'import/no-nodejs-modules': 'off',
|
||||||
|
'import/unambiguous': 'off',
|
||||||
|
'import/default': 'error',
|
||||||
|
'import/named': 'error',
|
||||||
|
'import/namespace': 'error',
|
||||||
|
'import/no-absolute-path': 'error',
|
||||||
|
'import/no-cycle': 'error',
|
||||||
|
'import/no-dynamic-require': 'error',
|
||||||
|
'import/no-internal-modules': 'off',
|
||||||
|
'import/no-relative-packages': 'error',
|
||||||
|
'import/no-relative-parent-imports': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
ignore: ['#[src,root,components,pages,assets,layouts,stores,plugins,context,types]/*'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'import/no-self-import': 'error',
|
||||||
|
'import/no-unresolved': 'error',
|
||||||
|
'import/no-useless-path-segments': 'error',
|
||||||
|
'import/no-webpack-loader-syntax': 'error',
|
||||||
|
'import/consistent-type-specifier-style': 'error',
|
||||||
|
'import/exports-last': 'off',
|
||||||
|
'import/extensions': [
|
||||||
|
'error',
|
||||||
|
'never',
|
||||||
|
{
|
||||||
|
json: 'always',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'import/first': 'error',
|
||||||
|
'import/group-exports': 'off',
|
||||||
|
'import/newline-after-import': 'error',
|
||||||
|
'import/no-anonymous-default-export': 'off',
|
||||||
|
'import/no-default-export': 'off',
|
||||||
|
'import/no-duplicates': 'error',
|
||||||
|
'import/no-named-default': 'error',
|
||||||
|
'import/no-namespace': 'error',
|
||||||
|
'import/no-unassigned-import': 'error',
|
||||||
|
|
||||||
|
'import/order': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
groups: [
|
||||||
|
'builtin',
|
||||||
|
'external',
|
||||||
|
'internal',
|
||||||
|
'parent',
|
||||||
|
'sibling',
|
||||||
|
'index',
|
||||||
|
'object',
|
||||||
|
'type',
|
||||||
|
],
|
||||||
|
'newlines-between': 'always',
|
||||||
|
alphabetize: {
|
||||||
|
order: 'asc',
|
||||||
|
caseInsensitive: true,
|
||||||
|
},
|
||||||
|
distinctGroup: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'import/prefer-default-export': 'off',
|
||||||
|
// "promise/catch-or-return": "error",
|
||||||
|
// "promise/no-return-wrap": "error",
|
||||||
|
// "promise/param-names": "error",
|
||||||
|
// "promise/always-return": "error",
|
||||||
|
// "promise/no-native": "off",
|
||||||
|
// "promise/no-nesting": "warn",
|
||||||
|
// "promise/no-promise-in-callback": "warn",
|
||||||
|
// "promise/no-callback-in-promise": "warn",
|
||||||
|
// "promise/avoid-new": "warn",
|
||||||
|
// "promise/no-new-statics": "error",
|
||||||
|
// "promise/no-return-in-finally": "warn",
|
||||||
|
// "promise/valid-params": "warn",
|
||||||
|
// "promise/prefer-await-to-callbacks": "error",
|
||||||
|
// "promise/no-multiple-resolved": "error",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.ts', '**/*.tsx'],
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
sourceType: 'module',
|
||||||
|
|
||||||
|
parserOptions: {
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
project: ['./tsconfig.json', '**/tsconfig.json'],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
'@typescript-eslint': fixupPluginRules(typescriptEslint),
|
||||||
|
},
|
||||||
|
|
||||||
|
extends: fixupConfigRules(
|
||||||
|
compat.extends(
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||||
|
'plugin:@typescript-eslint/strict',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-floating-promises': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
ignoreVoid: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
'no-void': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
allowAsStatement: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['!**/*.json'],
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
prettier,
|
||||||
|
},
|
||||||
|
|
||||||
|
extends: compat.extends('plugin:prettier/recommended'),
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['!**/*.json'],
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
prettier,
|
||||||
|
},
|
||||||
|
|
||||||
|
extends: compat.extends('plugin:prettier/recommended'),
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.json'],
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
json,
|
||||||
|
},
|
||||||
|
|
||||||
|
// extends: compat.extends("plugin:json/recommended-with-comments"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.yaml', '**/*.yml'],
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
parser: parser,
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
yml,
|
||||||
|
},
|
||||||
|
|
||||||
|
extends: compat.extends('plugin:yml/prettier'),
|
||||||
|
},
|
||||||
|
globalIgnores(['**/build/', 'cypress/reports/', 'cypress/screenshots/', '**/node_modules/']),
|
||||||
|
])
|
||||||
12119
package-lock.json
generated
12119
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@ -36,28 +36,29 @@
|
|||||||
"@badeball/cypress-cucumber-preprocessor": "^22.0.1",
|
"@badeball/cypress-cucumber-preprocessor": "^22.0.1",
|
||||||
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.4",
|
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.4",
|
||||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
||||||
|
"@eslint/compat": "^1.2.9",
|
||||||
|
"@eslint/js": "^9.26.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.31.1",
|
"@typescript-eslint/eslint-plugin": "^8.31.1",
|
||||||
"@typescript-eslint/parser": "^8.31.1",
|
"@typescript-eslint/parser": "^8.31.1",
|
||||||
"@vuepress/bundler-vite": "^2.0.0-rc.18",
|
"@vuepress/bundler-vite": "^2.0.0-rc.18",
|
||||||
"cypress": "^14.3.2",
|
"cypress": "^14.3.2",
|
||||||
"eslint": "^8.57.1",
|
"eslint": "^9.26.0",
|
||||||
"eslint-config-prettier": "^10.1.2",
|
"eslint-config-prettier": "^10.1.2",
|
||||||
"eslint-config-standard": "^17.1.0",
|
|
||||||
"eslint-import-resolver-typescript": "^3.10.1",
|
"eslint-import-resolver-typescript": "^3.10.1",
|
||||||
"eslint-plugin-cypress": "^3.6.0",
|
"eslint-plugin-cypress": "^4.3.0",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
"eslint-plugin-json": "^3.1.0",
|
"eslint-plugin-json": "^4.0.1",
|
||||||
"eslint-plugin-prettier": "^5.2.6",
|
"eslint-plugin-prettier": "^5.2.6",
|
||||||
"eslint-plugin-promise": "^6.6.0",
|
"eslint-plugin-promise": "^7.2.1",
|
||||||
"eslint-plugin-security": "^3.0.1",
|
"eslint-plugin-security": "^3.0.1",
|
||||||
"eslint-plugin-yml": "^1.18.0",
|
"eslint-plugin-yml": "^1.18.0",
|
||||||
|
"globals": "^16.0.0",
|
||||||
"multiple-cucumber-html-reporter": "^3.9.2",
|
"multiple-cucumber-html-reporter": "^3.9.2",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"ts-loader": "^9.5.2",
|
"ts-loader": "^9.5.2",
|
||||||
"tsx": "^4.19.4",
|
"tsx": "^4.19.4",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"vuepress": "^2.0.0-rc.18",
|
"vuepress": "^2.0.0-rc.22",
|
||||||
"vuepress-plugin-search-pro": "^2.0.0-rc.59",
|
|
||||||
"vuepress-theme-hope": "^2.0.0-rc.63"
|
"vuepress-theme-hope": "^2.0.0-rc.63"
|
||||||
},
|
},
|
||||||
"cypress-cucumber-preprocessor": {
|
"cypress-cucumber-preprocessor": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user