Skip to content

Commit

Permalink
pkg: fix eslint config.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Jan 15, 2025
1 parent 8e6fa58 commit 14ee01b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 113 deletions.
115 changes: 4 additions & 111 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -1,121 +1,14 @@
'use strict';

let globals, js;

try {
globals = require('bslint/globals');
js = require('bslint/js');
} catch (e) {
globals = require('globals');
js = require('@eslint/js');
}

const config = {
rules: {
'array-bracket-spacing': ['error', 'never'],
'arrow-parens': ['error', 'as-needed', {
'requireForBlockBody': true
}],
'arrow-spacing': 'error',
'block-spacing': ['error', 'always'],
'brace-style': ['error', '1tbs'],
'camelcase': ['error', {
'properties': 'never'
}],
'comma-dangle': ['error', 'never'],
'consistent-return': 'error',
'eol-last': ['error', 'always'],
'eqeqeq': ['error', 'always', {
'null': 'ignore'
}],
'func-name-matching': 'error',
'indent': ['off', 2, {
'ArrayExpression': 'off',
'SwitchCase': 1,
'CallExpression': {
'arguments': 'off'
},
'FunctionDeclaration': {
'parameters': 'off'
},
'FunctionExpression': {
'parameters': 'off'
},
'MemberExpression': 'off',
'ObjectExpression': 'off',
'ImportDeclaration': 'off'
}],
'handle-callback-err': 'off',
'linebreak-style': ['error', 'unix'],
'max-len': ['error', {
'code': 80,
'ignorePattern': 'function \\w+\\(',
'ignoreUrls': true
}],
'max-statements-per-line': ['error', {
'max': 1
}],
'new-cap': ['error', {
'newIsCap': true,
'capIsNew': false
}],
'new-parens': 'error',
'no-buffer-constructor': 'error',
'no-console': 'off',
'no-extra-semi': 'off',
'no-fallthrough': 'off',
'no-func-assign': 'off',
'no-implicit-coercion': 'error',
'no-multi-assign': 'error',
'no-multiple-empty-lines': ['error', {
'max': 1
}],
'no-nested-ternary': 'error',
'no-param-reassign': 'off',
'no-return-assign': 'error',
'no-return-await': 'off',
'no-shadow-restricted-names': 'error',
'no-tabs': 'error',
'no-trailing-spaces': 'error',
'no-unused-vars': ['error', {
'vars': 'all',
'args': 'none',
'caughtErrors': 'none',
'ignoreRestSiblings': false
}],
'no-use-before-define': ['error', {
'functions': false,
'classes': false
}],
'no-useless-escape': 'off',
'no-var': 'error',
'nonblock-statement-body-position': ['error', 'below'],
'padded-blocks': ['error', 'never'],
'prefer-arrow-callback': 'error',
'prefer-const': ['error', {
'destructuring': 'all',
'ignoreReadBeforeAssign': true
}],
'prefer-template': 'off',
'quotes': ['error', 'single'],
'semi': ['error', 'always'],
'spaced-comment': ['error', 'always', {
'exceptions': ['!']
}],
'space-before-blocks': 'error',
'strict': 'error',
'unicode-bom': ['error', 'never'],
'wrap-iife': ['error', 'inside']
}
};
const js = require('bslint-extra');

module.exports = [
js.configs.recommended,
config,
js.configs.bcoin,
{
languageOptions: {
globals: {
...globals.node
...js.globals.node
},
ecmaVersion: 'latest'
}
Expand All @@ -133,7 +26,7 @@ module.exports = [
files: ['test/{,**/}*.{js,cjs,mjs}'],
languageOptions: {
globals: {
...globals.mocha,
...js.globals.mocha,
register: 'readable'
}
},
Expand Down
13 changes: 12 additions & 1 deletion package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
},
"devDependencies": {
"bmocha": "^2.2.1",
"bsert": "~0.0.13"
"bsert": "~0.0.13",
"bslint-extra": "~0.0.2"
},
"engines": {
"node": ">=8.0.0"
Expand Down

0 comments on commit 14ee01b

Please sign in to comment.