Skip to content

Commit

Permalink
feat: Include extended configurations using the eslint compat wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
  • Loading branch information
susnux committed Jan 31, 2023
1 parent 53ca16f commit 2314760
Showing 1 changed file with 35 additions and 22 deletions.
57 changes: 35 additions & 22 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
// New eslint syntax
// https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new
import { FlatCompat } from "@eslint/eslintrc";
import { fileURLToPath } from "url";

import path from "path";
import globals from "globals"
import vue from 'eslint-plugin-vue'
import n from 'eslint-plugin-n'
import jsdoc from 'eslint-plugin-jsdoc'
import jest from 'eslint-plugin-jest'
import cypress from 'eslint-plugin-cypress'

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname
});

export default [
// 'eslint:recommended',
// 'plugin:import/errors',
// 'plugin:import/warnings',
// 'plugin:n/recommended',
// 'plugin:vue/recommended',
// 'plugin:@nextcloud/recommended',
// 'plugin:jsdoc/recommended',
// 'standard',
// 'plugin:jest/recommended',
// 'plugin:cypress/recommended',
'eslint:recommended',
// compat: Key "plugins": Key "0": Expected an object
...compat.extends('plugin:import/errors'),
// compat: Key "plugins": Key "0": Expected an object
...compat.extends('plugin:import/warnings'),
// compat: unexpected key: global
...compat.extends('plugin:n/recommended'),
// compat: Unexpected key "extends"
...compat.extends('plugin:vue/recommended'),
// compat: Unexpected key "env" found.
...compat.extends('plugin:@nextcloud/recommended'),
// compat: Key "plugins": Key "0": Expected an object
...compat.extends('plugin:jsdoc/recommended'),
// compat: unexpected key "parserOptions"
...compat.extends('standard'),
// compat: Key "plugins": Key "0": Expected an object.
...compat.extends('plugin:jest/recommended'),
// compat: `plugins` uses strings instead of objects
// & does not work with compat: "languageOptions": Key "globals": Global "AudioWorkletGlobalScope " has leading or trailing whitespace
//...compat.extends('plugin:cypress/recommended'),
{
files: [
'**/*.js',
Expand All @@ -38,11 +56,6 @@ export default [
requireConfigFile: false,
},
},
plugins: {
vue,
n,
jsdoc,
},
settings: {
'import/resolver': {
node: {
Expand Down Expand Up @@ -178,7 +191,7 @@ export default [
},
{
// Match jest test files
"files": ["__tests__/**/*.*s", "tests/**/*.*s"],
'files': ['__tests__/**/*.*s', 'tests/**/*.*s'],
// globals are included in plugin:jest
rules: {
'n/no-unpublished-import': 'off',
Expand All @@ -204,14 +217,14 @@ export default [
},
plugins: {
cypress,
},
},
},
{
// Match config files like babel.config.js, webpack.config.mjs, eslint.config.cjs etc.
"files": ["*.config.*s"],
"rules": {
"n/no-unpublished-import": "off",
"n/no-extraneous-import": "off",
}
}
},
},
]

0 comments on commit 2314760

Please sign in to comment.