Skip to content

Commit

Permalink
eslint: used @Stylistic rules
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jun 3, 2024
1 parent 55dadea commit 1074cbf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coding-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install eslint
- run: npx eslint "src/**/*.js"
- run: npm install
- run: npx eslint
30 changes: 23 additions & 7 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';

export default [
{
ignores: ['*/', '!src/'],
},

pluginJs.configs.recommended,

stylistic.configs.customize({
indent: 'tab',
braceStyle: '1tbs',
arrowParens: true,
semi: true,
jsx: false,
}),

{
languageOptions: {
ecmaVersion: 'latest',
globals: globals.browser,
},
plugins: {
'@stylistic': stylistic,
},
rules: {
indent: ['error', 'tab'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'prefer-arrow-callback': ['error'],
'arrow-parens': ['error'],
'arrow-spacing': ['error'],
'no-var': ['error'],
'@stylistic/no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0 }],
'@stylistic/new-parens': ['error', 'never'],
'@stylistic/padded-blocks': 'off',
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
'prefer-arrow-callback': 'error',
'no-var': 'error',
},
},
];
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"devDependencies": {
"@eslint/js": "^9.1.1",
"eslint": "^9.1.1",
"globals": "^15.1.0"
"@eslint/js": "^9.4.0",
"@stylistic/eslint-plugin": "^2.1.0",
"eslint": "^9.4.0",
"globals": "^15.3.0"
}
}

0 comments on commit 1074cbf

Please sign in to comment.