Skip to content

Commit

Permalink
fix(General): 🎨 Updated the rest of eslint to new flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
Joery-M committed Sep 25, 2024
1 parent 4e09192 commit d580155
Show file tree
Hide file tree
Showing 8 changed files with 3,657 additions and 4,740 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

54 changes: 0 additions & 54 deletions .eslintrc.json

This file was deleted.

132 changes: 132 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
//@ts-check
import js from '@eslint/js';
import vueI18n from '@intlify/eslint-plugin-vue-i18n';
import prettierConfig from 'eslint-plugin-prettier/recommended';
import tailwindcss from 'eslint-plugin-tailwindcss';
import eslintPluginVue from 'eslint-plugin-vue';
import globals from 'globals';
import ts from 'typescript-eslint';
import vueParser from 'vue-eslint-parser';

export default ts.config(
{
ignores: ['**/dist/**/*', '**/node_modules/**/*', '**/renovate.json']
},
js.configs.recommended,
...ts.configs.recommended,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
...eslintPluginVue.configs['flat/recommended'],
...tailwindcss.configs['flat/recommended'],

// ----- i18n -----
// Use the base config, then re-add the rules on specific files
...vueI18n.configs['flat/base'],
{
name: '@intlify/vue-i18n:recommended:setup',
files: ['**/packages/safelight/**/*.vue', '**/packages/shared/**/*.vue'],
ignores: ['dist/**', 'generated/**', '**/*.scss', '**/views/dev/**'],
languageOptions: {
ecmaVersion: 2018,
sourceType: 'module',
globals: globals.browser,
parserOptions: {
ecmaFeatures: {
jsx: true
}
}
}
},
{
name: '@intlify/vue-i18n:recommended:rules',
files: ['**/packages/safelight/**/*.vue', '**/packages/shared/**/*.vue'],
ignores: ['dist/**', 'generated/**', '**/*.scss', '**/views/dev/**'],
rules: {
'@intlify/vue-i18n/no-deprecated-i18n-component': 'warn',
'@intlify/vue-i18n/no-deprecated-i18n-place-attr': 'warn',
'@intlify/vue-i18n/no-deprecated-i18n-places-prop': 'warn',
'@intlify/vue-i18n/no-deprecated-modulo-syntax': 'warn',
'@intlify/vue-i18n/no-deprecated-tc': 'warn',
'@intlify/vue-i18n/no-html-messages': 'warn',
'@intlify/vue-i18n/no-i18n-t-path-prop': 'warn',
'@intlify/vue-i18n/no-missing-keys': 'off',
'@intlify/vue-i18n/no-raw-text': [
'warn',
{
attributes: {
'/.+/': [
'title',
'aria-label',
'aria-describedby',
'aria-placeholder',
'aria-roledescription',
'aria-valuetext'
],
input: ['placeholder'],
img: ['alt']
},
ignoreNodes: ['md-icon', 'v-icon'],
ignorePattern: '^[-#:()&]+$'
}
],
'@intlify/vue-i18n/no-v-html': 'warn',
'@intlify/vue-i18n/valid-message-syntax': 'warn'
}
},

prettierConfig,
{
files: ['*.vue', '**/*.vue'],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
languageOptions: {
parser: vueParser,
parserOptions: {
parser: ts.parser,
// extraFileExtensions: ['.vue'],
sourceType: 'module',
tsconfigRootDir: import.meta.dirname
}
},
rules: {
'no-unused-vars': 'off',
'vue/multi-word-component-names': 'off',
'vue/no-multiple-template-root': 'off',

'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true
}
],

'vue/no-v-for-template-key': 'off',
'vue/no-v-model-argument': 'off',
'no-async-promise-executor': 'off',
'no-undef': 'off',
'no-dupe-class-members': 'off',

'tailwindcss/no-custom-classname': 'off'
}
},
{
files: ['**/*.json'],
rules: {
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'off'
}
}
);
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@
"packages/plugin-types"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@eslint/js": "^9.11.1",
"@intlify/eslint-plugin-vue-i18n": "^3.0.0",
"@types/eslint__js": "^8.42.3",
"@vitejs/plugin-vue": "^5.1.4",
"@vitest/browser": "^2.1.1",
"@vitest/ui": "^2.1.1",
"eslint": "^9.0.0",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-tailwindcss": "^3.17.4",
"eslint-plugin-vue": "^9.28.0",
"globals": "^15.9.0",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.6",
"typescript": "^5.5.4",
Expand Down
28 changes: 0 additions & 28 deletions packages/safelight/.eslintrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions packages/safelight/src/views/dev/.eslintrc.json

This file was deleted.

Loading

0 comments on commit d580155

Please sign in to comment.