-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from green-code-initiative/45-invalid-option-e…
…xt-perhaps-you-meant-c fix(eslint): migrate to flat configuration
- Loading branch information
Showing
14 changed files
with
282 additions
and
161 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import globals from "globals"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
|
||
import js from "@eslint/js"; | ||
import { includeIgnoreFile } from "@eslint/compat"; | ||
|
||
import markdown from 'eslint-plugin-markdown' | ||
import vue from 'eslint-plugin-vue' | ||
import prettier from "eslint-config-prettier"; | ||
import ecocode from '@ecocode/eslint-plugin' | ||
|
||
import playwright from 'eslint-plugin-playwright' | ||
import storybook from 'eslint-plugin-storybook' | ||
|
||
// Safely retrieve the .gitignore path | ||
// see https://eslint.org/docs/latest/use/configure/ignore#including-gitignore-files | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const gitignorePath = path.resolve(__dirname, ".gitignore"); | ||
|
||
|
||
// patch ecocode plugin for flat config support | ||
// see https://eslint.org/docs/latest/extend/plugin-migration-flat-config | ||
if (!ecocode.configs['flat/recommended']) { | ||
ecocode.meta = { | ||
name: "@ecocode/eslint-plugin", | ||
version: "1.5.0" | ||
} | ||
ecocode.configs['flat/recommended'] = { | ||
plugins: { | ||
'@ecocode': ecocode | ||
}, | ||
rules: ecocode.configs.recommended.rules, | ||
}; | ||
} | ||
|
||
export default [ | ||
includeIgnoreFile(gitignorePath), | ||
prettier, | ||
{ | ||
files: ["**/*.vue", "**/*.js"], | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: "module", | ||
globals: { | ||
...globals.node, // probably to be removed - allow node for node.process in main.js sonar-i18n.js | ||
} | ||
}, | ||
}, | ||
js.configs.recommended, | ||
...markdown.configs.recommended, | ||
...vue.configs['flat/recommended'], | ||
ecocode.configs['flat/recommended'], | ||
{ | ||
...storybook.configs['plugin:storybook/recommended'], | ||
files: ['**/*.stories.js'], | ||
}, | ||
{ | ||
...playwright.configs['flat/recommended'], | ||
files: ['e2e/**/*.spec.js'], | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.