Migrate eslint config [SCI-11867]

This commit is contained in:
Martin Artnik 2025-05-28 14:20:52 +02:00
parent 8d9ee4884a
commit 7c23fb1002
3 changed files with 67 additions and 49 deletions

View file

@ -1,2 +0,0 @@
node_modules/
public/

View file

@ -1,47 +0,0 @@
{
"env": {
"browser": true,
"jquery": true,
"es6": true,
"node": true
},
"extends": ["airbnb", "plugin:vue/base"],
"rules": {
"import/extensions": "off",
"import/no-unresolved": "off",
"spaced-comment": [
"error",
"always",
{
"markers": ["="]
}
],
"lines-around-comment": [
"warn",
{
"beforeLineComment": false
}
],
"max-len": [
"error",
{
"code": 180
}
],
"vue/max-len": [
"error",
{
"code": 180,
"template": 240,
"tabWidth": 2
}
],
"comma-dangle": [
"error",
"never"
]
},
"globals": {
"_": true
}
}

67
eslint.config.mjs Normal file
View file

@ -0,0 +1,67 @@
import { FlatCompat } from '@eslint/eslintrc';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import globals from 'globals';
import { defineConfig, globalIgnores } from 'eslint/config';
// eslint-disable-next-line no-underscore-dangle
const __filename = fileURLToPath(import.meta.url);
// eslint-disable-next-line no-underscore-dangle
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname
});
export default defineConfig([
globalIgnores(['node_modules', './app/assets/builds/**', './public/']),
{
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.es6,
jquery: true,
_: true
}
}
},
// Migrate extends and plugins using FlatCompat
...compat.extends('airbnb', 'plugin:vue/base'),
{
rules: {
'import/extensions': 'off',
'import/no-unresolved': 'off',
'spaced-comment': [
'error',
'always',
{
markers: ['=']
}
],
'lines-around-comment': [
'warn',
{
beforeLineComment: false
}
],
'max-len': [
'error',
{
code: 180
}
],
'vue/max-len': [
'error',
{
code: 180,
template: 240,
tabWidth: 2
}
],
'comma-dangle': ['error', 'never']
}
}
]);