Skip to content

Commit

Permalink
try out flatcompat for package that does not support flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
NFriedo committed Sep 27, 2024
1 parent f852dda commit 78b8e65
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,58 @@
const pluginVue = require("eslint-plugin-vue");
const js = require("@eslint/js");
const vueTsEslintConfig = require("@vue/eslint-config-typescript");
// const vueTsEslintConfig = require("@vue/eslint-config-typescript");
const tseslint = require("typescript-eslint");
const schulcloud = require("./lib/eslint-plugin-schulcloud");
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended");
const globals = require("globals");

const { FlatCompat } = require("@eslint/eslintrc");

const compat = new FlatCompat();

module.exports = [
...pluginVue.configs["flat/essential"],
js.configs.recommended,
...vueTsEslintConfig({
// not supported as of version 13, version 14 will introduce support for the flat config
// for version 14 of this, we need to upgrade to eslint 9 because of the peer dependency
extends: [
// By default, only the recommended rules are enabled.
"recommended",
],
supportedScriptLangs: {
ts: true,
// ...vueTsEslintConfig({
// // not supported as of version 13, version 14 will introduce support for the flat config
// // for version 14 of this, we need to upgrade to eslint 9 because of the peer dependency
// extends: [
// // By default, only the recommended rules are enabled.
// "recommended",
// ],
// supportedScriptLangs: {
// ts: true,

// [!DISCOURAGED]
// Set to `true` to allow plain `<script>` or `<script setup>` blocks.
// This might result-in false positive or negatives in some rules for `.vue` files.
// Note you also need to configure `allowJs: true` and `checkJs: true`
// in corresponding `tsconfig.json` files.
js: true,
},
}),
// // [!DISCOURAGED]
// // Set to `true` to allow plain `<script>` or `<script setup>` blocks.
// // This might result-in false positive or negatives in some rules for `.vue` files.
// // Note you also need to configure `allowJs: true` and `checkJs: true`
// // in corresponding `tsconfig.json` files.
// js: true,
// },
// }),
...compat.extends("@vue/eslint-config-typescript/recommended"),
eslintPluginPrettierRecommended, // need to be the last item

{
languageOptions: {
parser: tseslint.parser,
// parser: tseslint.parser,
ecmaVersion: 2020,
globals: {
...globals.node,
},
},
plugins: {
schulcloud,
"@typescript-eslint": tseslint.plugin,
// "@typescript-eslint": tseslint.plugin,
},
ignores: [
".vscode/**",
"node_modules/**",
"**/dist/**",
"src/serverApi/**",
"src/fileStorageApi/**",
"src/h5pEditorApi/**",
".vscode/*",
"node_modules/*",
"**/dist/*",
"src/serverApi/*",
"src/fileStorageApi/*",
"src/h5pEditorApi/*",
],
rules: {
"schulcloud/material-icon-imports": "error",
Expand Down

0 comments on commit 78b8e65

Please sign in to comment.