Skip to content

Commit

Permalink
eslint.config.jsのコミットし忘れ
Browse files Browse the repository at this point in the history
  • Loading branch information
logue committed Apr 25, 2024
1 parent 7e59841 commit 9677779
Showing 1 changed file with 107 additions and 0 deletions.
107 changes: 107 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import globals from 'globals';
import eslintConfigPrettier from 'eslint-config-prettier';
import path from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
import pluginJs from '@eslint/js';
import pluginImport from 'eslint-plugin-import';

// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: pluginJs.configs.recommended,
});

export default [
{
ignores: [
'.vscode/',
'.yarn/',
'dist/',
'public/',
'docs/',
'src/**/*.generated.*',
'eslint.config.js',
],
},
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
...compat.extends('standard'),
{
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
plugins: {
import: pluginImport,
},
settings: {
// This will do the trick
'import/parsers': {
espree: ['.js', '.cjs', '.mjs', '.jsx'],
},
'import/resolver': {
node: true,
alias: {
map: [
['@', './src'],
['~', './node_modules'],
],
extensions: ['.js', '.jsx'],
},
},
vite: {
configPath: './vite.config.ts',
},
},
rules: {
camelcase: 'off',
'no-unused-vars': 'warn',
// Fix for Vue setup style
'import/default': 'off',
// Fix for Vue setup style
'import/no-default-export': 'off',
// Sort Import Order.
// see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md#importorder-enforce-a-convention-in-module-import-order
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'parent',
'sibling',
'index',
'object',
'type',
],
pathGroups: [
// Vue Core
{
pattern:
'{vue,vue-router,vuex,@/stores,vue-i18n,pinia,vite,vitest,vitest/**,@vitejs/**,@vue/**}',
group: 'external',
position: 'before',
},
// Internal Codes
{
pattern: '{@/**}',
group: 'internal',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
alphabetize: {
order: 'asc',
},
'newlines-between': 'always',
},
],
},
},
// ...pluginVue.configs['flat/recommended'],
eslintConfigPrettier,
];

0 comments on commit 9677779

Please sign in to comment.