mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-04 12:14:37 +08:00
Migrate eslint config [SCI-11867]
This commit is contained in:
parent
8d9ee4884a
commit
7c23fb1002
3 changed files with 67 additions and 49 deletions
|
@ -1,2 +0,0 @@
|
|||
node_modules/
|
||||
public/
|
|
@ -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
67
eslint.config.mjs
Normal 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']
|
||||
}
|
||||
}
|
||||
]);
|
Loading…
Add table
Reference in a new issue