Skip to content

Commit

Permalink
fix: adding linter config
Browse files Browse the repository at this point in the history
  • Loading branch information
wei3erHase committed Oct 1, 2024
1 parent bd05971 commit 7fd8039
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions js/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { fixupConfigRules } from '@eslint/compat';
import globals from 'globals';
import babelParser from '@babel/eslint-parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: ['lib', 'dist'],
}, ...fixupConfigRules(
compat.extends('eslint:recommended', 'plugin:import/errors', 'plugin:import/warnings'),
), {
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parser: babelParser,
parserOptions: {
requireConfigFile: false,
},
ecmaVersion: 8,
sourceType: 'module',
},

settings: {
react: {
version: 'detect',
},
},

rules: {
'no-trailing-spaces': ['error'],
'import/first': ['error'],
'import/no-commonjs': ['error'],
'import/namespace': ['warn'],

'import/order': ['error', {
groups: [['internal', 'external', 'builtin'], ['index', 'sibling', 'parent']],
'newlines-between': 'always',
}],

indent: ['error', 2, {
MemberExpression: 1,
SwitchCase: 1,
}],

'linebreak-style': ['error', 'unix'],
'no-console': [0],

quotes: ['error', 'single', {
avoidEscape: true,
allowTemplateLiterals: true,
}],

'require-await': ['error'],
semi: ['error', 'always'],
},
}];

0 comments on commit 7fd8039

Please sign in to comment.