Skip to content

Commit

Permalink
eslint: enable most stylistic rules
Browse files Browse the repository at this point in the history
  • Loading branch information
vogler committed Nov 8, 2023
1 parent efe4faa commit 011eddf
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 16 deletions.
82 changes: 66 additions & 16 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,28 +1,78 @@
module.exports = {
'env': {
'es2021': true,
'node': true,
env: {
es2021: true,
node: true,
},
"extends": "eslint:recommended",
'overrides': [
extends: 'eslint:recommended',
overrides: [
{
'env': {
'node': true,
env: {
node: true,
},
'files': [
files: [
'.eslintrc.{js,cjs}',
],
'parserOptions': {
'sourceType': 'script',
parserOptions: {
sourceType: 'script',
},
},
],
'parserOptions': {
'ecmaVersion': 'latest',
'sourceType': 'module',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
'rules': {
'semi': 'error',
'no-unused-vars': ["error", { "argsIgnorePattern": "^_" }],
plugins: [
'@stylistic/js',
],
// https://eslint.org/docs/latest/rules/
// https://eslint.style/packages/js
rules: {
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@stylistic/js/array-bracket-newline': ['error', 'consistent'],
'@stylistic/js/array-bracket-spacing': 'error',
'@stylistic/js/array-element-newline': ['error', 'consistent'],
'@stylistic/js/arrow-parens': ['error', 'as-needed'],
'@stylistic/js/arrow-spacing': 'error',
'@stylistic/js/block-spacing': 'error',
'@stylistic/js/brace-style': 'error',
'@stylistic/js/comma-dangle': ['error', 'always-multiline'],
'@stylistic/js/comma-spacing': 'error',
'@stylistic/js/comma-style': 'error',
'@stylistic/js/eol-last': 'error',
'@stylistic/js/func-call-spacing': 'error',
'@stylistic/js/function-paren-newline': ['error', 'consistent'],
'@stylistic/js/implicit-arrow-linebreak': 'error',
'@stylistic/js/indent': ['error', 2],
'@stylistic/js/key-spacing': 'error',
'@stylistic/js/keyword-spacing': 'error',
'@stylistic/js/linebreak-style': 'error',
'@stylistic/js/no-extra-parens': 'error',
'@stylistic/js/no-extra-semi': 'error',
'@stylistic/js/no-mixed-spaces-and-tabs': 'error',
'@stylistic/js/no-multi-spaces': 'error',
'@stylistic/js/no-multiple-empty-lines': 'error',
'@stylistic/js/no-tabs': 'error',
'@stylistic/js/no-trailing-spaces': 'error',
'@stylistic/js/no-whitespace-before-property': 'error',
'@stylistic/js/nonblock-statement-body-position': 'error',
'@stylistic/js/object-curly-newline': 'error',
'@stylistic/js/object-curly-spacing': ['error', 'always'],
'@stylistic/js/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
'@stylistic/js/quote-props': ['error', 'as-needed'],
'@stylistic/js/quotes': ['error', 'single'],
'@stylistic/js/rest-spread-spacing': 'error',
'@stylistic/js/semi': 'error',
'@stylistic/js/semi-spacing': 'error',
'@stylistic/js/semi-style': 'error',
'@stylistic/js/space-before-blocks': 'error',
'@stylistic/js/space-before-function-paren': ['error', { anonymous: 'never', named: 'never', asyncArrow: 'always' }],
'@stylistic/js/space-in-parens': 'error',
'@stylistic/js/space-infix-ops': 'error',
'@stylistic/js/space-unary-ops': 'error',
'@stylistic/js/spaced-comment': 'error',
'@stylistic/js/switch-colon-spacing': 'error',
'@stylistic/js/template-curly-spacing': 'error',
'@stylistic/js/template-tag-spacing': 'error',
'@stylistic/js/wrap-regex': 'error',
},
};
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"author": "Ralf Vogler",
"license": "AGPL-3.0-only",
"devDependencies": {
"@stylistic/eslint-plugin-js": "^1.0.1",
"eslint": "^8.53.0"
}
}

0 comments on commit 011eddf

Please sign in to comment.