1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-22 09:46:58 +01:00

fix: lint config

This commit is contained in:
getlarge 2021-03-09 14:19:10 +01:00
parent cc3aa3fdd3
commit 90466cf6ae
No known key found for this signature in database
GPG Key ID: E4E13243600F9566
3 changed files with 186 additions and 190 deletions

View File

@ -1,3 +1,6 @@
dist dist
node_modules node_modules
coverage coverage
media
docs
compose

View File

@ -1,238 +1,231 @@
module.exports = { module.exports = {
extends: 'airbnb-base', extends: ['eslint:recommended', 'airbnb-base', 'plugin:import/recommended'],
parser: '@babel/eslint-parser', parser: '@babel/eslint-parser',
parserOptions: { requireConfigFile: false }, parserOptions: { requireConfigFile: false },
env: { env: {
browser: true, browser: true,
node: true, node: true,
}, },
settings: { settings: {
'import/ignore': ['node_modules', '.(scss|css)$', '.(jpe?g|png|gif|svg)'], 'import/ignore': ['node_modules', '.(scss|css)$', '.(jpe?g|png|gif|svg)'],
}, },
rules: { rules: {
/** /**
* Possible Errors * Possible Errors
* http://eslint.org/docs/rus/#possible-errors * http://eslint.org/docs/rus/#possible-errors
*/ */
// Allow dangling commas for multiline arrays and objects // Allow dangling commas for multiline arrays and objects
// http://eslint.org/docs/rules/comma-dangle // http://eslint.org/docs/rules/comma-dangle
'comma-dangle': [1, 'only-multiline'], 'comma-dangle': [1, 'only-multiline'],
// Warn against use of console for non-error logging // Warn against use of console for non-error logging
// http://eslint.org/docs/rules/no-console // http://eslint.org/docs/rules/no-console
'no-console': [1, { allow: ['error'] }], 'no-console': [1, { allow: ['error'] }],
// Allow use of Object.prototypes builtins directly // Allow use of Object.prototypes builtins directly
// http://eslint.org/docs/rules/no-prototype-builtins // http://eslint.org/docs/rules/no-prototype-builtins
'no-prototype-builtins': [0], 'no-prototype-builtins': [0],
/** /**
* Best Practices * Best Practices
* http://eslint.org/docs/rules/#best-practices * http://eslint.org/docs/rules/#best-practices
*/ */
// Allow else clauses after an if with a return // Allow else clauses after an if with a return
// http://eslint.org/docs/rules/no-else-return // http://eslint.org/docs/rules/no-else-return
'no-else-return': [0], 'no-else-return': [0],
// Disallow reassignment of function parameters (but allow assigning to parameter's properties) // Disallow reassignment of function parameters (but allow assigning to parameter's properties)
// http://eslint.org/docs/rules/no-param-reassign.html // http://eslint.org/docs/rules/no-param-reassign.html
'no-param-reassign': [2, { props: false }], 'no-param-reassign': [2, { props: false }],
/** /**
* Variables * Variables
* http://eslint.org/docs/rules/#variables * http://eslint.org/docs/rules/#variables
*/ */
// Disallow use of variables and classes before they are defined // Disallow use of variables and classes before they are defined
// http://eslint.org/docs/rules/no-use-before-define // http://eslint.org/docs/rules/no-use-before-define
'no-use-before-define': [2, { functions: false, classes: true }], 'no-use-before-define': [2, { functions: false, classes: true }],
// Disallow declaration of variables that are not used in the code, unless they are prefixed by // Disallow declaration of variables that are not used in the code, unless they are prefixed by
// `ignored` (useful for creating subset objects through destructuring and rest objects) // `ignored` (useful for creating subset objects through destructuring and rest objects)
// http://eslint.org/docs/rules/no-unused-vars // http://eslint.org/docs/rules/no-unused-vars
'no-unused-vars': [ 'no-unused-vars': [
2, 2,
{ {
vars: 'local', vars: 'local',
args: 'after-used', args: 'after-used',
varsIgnorePattern: 'ignored.+', varsIgnorePattern: 'ignored.+',
}, },
], ],
/** /**
* Stylelistic Issues * Stylelistic Issues
* (http://eslint.org/docs/rules/#stylistic-issues) * (http://eslint.org/docs/rules/#stylistic-issues)
*/ */
// Enforce 4-space indents, except for switch cases // Enforce 4-space indents, except for switch cases
// http://eslint.org/docs/rules/indent // http://eslint.org/docs/rules/indent
indent: [2, 4, { SwitchCase: 1, VariableDeclarator: 1 }], 'indent': [2, 4, { SwitchCase: 1, VariableDeclarator: 1 }],
// Specify the maximum length of a code line to be 100 // Specify the maximum length of a code line to be 100
// http://eslint.org/docs/rules/max-len // http://eslint.org/docs/rules/max-len
'max-len': [ 'max-len': [
2, 2,
{ {
code: 105, // Use 105 to give some leeway for *just* slightly longer lines when convienient code: 105, // Use 105 to give some leeway for *just* slightly longer lines when convienient
ignorePattern: '^(import|export) .* from .*$', ignorePattern: '^(import|export) .* from .*$',
ignoreComments: false, ignoreComments: false,
ignoreTrailingComments: true, ignoreTrailingComments: true,
ignoreUrls: true, ignoreUrls: true,
}, },
],
// Require capitalization when using `new`, but don't require capitalized functions to be called
// with new
// http://eslint.org/docs/rules/new-cap
'new-cap': [2, { newIsCap: true, capIsNew: false }],
// Allow the continue statement
// http://eslint.org/docs/rules/no-continue
'no-continue': [0],
// Disallow un-paren'd mixes of different operators if they're not of the same precendence
// http://eslint.org/docs/rules/no-mixed-operators
'no-mixed-operators': [
2,
{
groups: [
['+', '-', '*', '/', '%', '**'],
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
], ],
allowSamePrecedence: true,
},
],
// Allow use of unary increment/decrement operators // Require capitalization when using `new`, but don't require capitalized functions to be called
// http://eslint.org/docs/rules/no-plusplus // with new
'no-plusplus': [0], // http://eslint.org/docs/rules/new-cap
'new-cap': [2, { newIsCap: true, capIsNew: false }],
// Always allow dangling underscores // Allow the continue statement
// http://eslint.org/docs/rules/no-underscore-dangle // http://eslint.org/docs/rules/no-continue
'no-underscore-dangle': [0], 'no-continue': [0],
// Require unix-style line breaks // Disallow un-paren'd mixes of different operators if they're not of the same precendence
// http://eslint.org/docs/rules/linebreak-style // http://eslint.org/docs/rules/no-mixed-operators
'linebreak-style': [2, 'unix'], 'no-mixed-operators': [
2,
{
groups: [
['+', '-', '*', '/', '%', '**'],
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
allowSamePrecedence: true,
},
],
// Require operators to always be at the end of a line, except for the ternary operator // Allow use of unary increment/decrement operators
// http://eslint.org/docs/rules/operator-linebreak // http://eslint.org/docs/rules/no-plusplus
'operator-linebreak': [ 'no-plusplus': [0],
2,
'after',
{ overrides: { '?': 'ignore', ':': 'ignore' } },
],
// Require properties to be consistently quoted. Force numbers to be quoted, as they can have // Always allow dangling underscores
// weird behaviour during the coercion into a string) // http://eslint.org/docs/rules/no-underscore-dangle
// http://eslint.org/docs/rules/quote-props 'no-underscore-dangle': [0],
'quote-props': [
2,
'consistent',
{ keywords: false, unnecessary: true, numbers: true },
],
// Require spaces before parens for anonymous function declarations // Require unix-style line breaks
// http://eslint.org/docs/rules/space-before-function-paren // http://eslint.org/docs/rules/linebreak-style
'space-before-function-paren': [2, { anonymous: 'always', named: 'never' }], 'linebreak-style': [2, 'unix'],
// Require a space immediately following the // or /* in a comment for most comments // Require operators to always be at the end of a line, except for the ternary operator
// http://eslint.org/docs/rules/spaced-comment // http://eslint.org/docs/rules/operator-linebreak
'spaced-comment': [ 'operator-linebreak': [
2, 2,
'always', 'after',
{ { overrides: { '?': 'ignore', ':': 'ignore' } },
line: { ],
exceptions: ['-', '+'],
},
block: {
exceptions: ['*'],
},
},
],
// We don't like semicolons so kill them // Require properties to be consistently quoted. Force numbers to be quoted, as they can have
// http://eslint.org/docs/rules/semi // weird behaviour during the coercion into a string)
semi: [2, 'never'], // http://eslint.org/docs/rules/quote-props
'quote-props': [
2,
'consistent',
{ keywords: false, unnecessary: true, numbers: true },
],
/** // Require spaces before parens for anonymous function declarations
// http://eslint.org/docs/rules/space-before-function-paren
'space-before-function-paren': [2, { anonymous: 'always', named: 'never' }],
// Require a space immediately following the // or /* in a comment for most comments
// http://eslint.org/docs/rules/spaced-comment
'spaced-comment': [
2,
'always',
{
line: {
exceptions: ['-', '+'],
},
block: {
exceptions: ['*'],
},
},
],
// We don't like semicolons so kill them
// http://eslint.org/docs/rules/semi
'semi': [2, 'never'],
/**
* Import rules * Import rules
* https://github.com/benmosher/eslint-plugin-import#rules * https://github.com/benmosher/eslint-plugin-import#rules
*/ */
// Ensure named imports coupled with named exports // Ensure named imports coupled with named exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
'import/named': 2, 'import/named': 2,
// Ensure default import coupled with default export // Ensure default import coupled with default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
'import/default': 2, 'import/default': 2,
// Disallow namespace (wildcard) imports // Disallow namespace (wildcard) imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
'import/no-namespace': 2, 'import/no-namespace': 2,
// Enforce imports to not specify a trailing .js extension // Enforce imports to not specify a trailing .js extension
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
'import/extensions': [2, { js: 'never' }], 'import/extensions': [2, { js: 'never' }],
// Enforce module import order: builtin -> external -> internal // Enforce module import order: builtin -> external -> internal
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
'import/order': [ 'import/order': [
2, 2,
{ {
groups: [ groups: [
'builtin', 'builtin',
'external', 'external',
['internal', 'parent', 'sibling', 'index'], ['internal', 'parent', 'sibling', 'index'],
],
},
], ],
},
],
/** /**
* ES6-specific Issues * ES6-specific Issues
* (http://eslint.org/docs/rules/#ecmascript-6) * (http://eslint.org/docs/rules/#ecmascript-6)
*/ */
// Don't require parens in arrow function arguments 'arrow-body-style': [0],
// http://eslint.org/docs/rules/arrow-parens 'arrow-parens': [0],
'arrow-parens': [0], 'arrow-spacing': [0],
'constructor-super': [0],
// Ignore built-in import sorting for eslint-plugin-import's version 'generator-star-spacing': [0],
// http://eslint.org/docs/rules/sort-imports 'no-class-assign': [0],
'sort-imports': [0], 'no-confusing-arrow': [0],
'arrow-body-style': [0], 'no-const-assign': [0],
'arrow-parens': [0], 'no-dupe-class-members': [0],
'arrow-spacing': [0], 'no-duplicate-imports': [0],
'constructor-super': [0], 'no-new-symbol': [0],
'generator-star-spacing': [0], 'no-restricted-imports': [0],
'no-class-assign': [0], 'no-this-before-super': [0],
'no-confusing-arrow': [0], 'no-useless-computed-key': [0],
'no-const-assign': [0], 'no-useless-constructor': [0],
'no-dupe-class-members': [0], 'no-useless-rename': [0],
'no-duplicate-imports': [0], 'no-var': [0],
'no-new-symbol': [0], 'object-shorthand': [0],
'no-restricted-imports': [0], 'prefer-arrow-callback': [0],
'no-this-before-super': [0], 'prefer-const': [0],
'no-useless-computed-key': [0], 'prefer-reflect': [0],
'no-useless-constructor': [0], 'prefer-rest-params': [0],
'no-useless-rename': [0], 'prefer-spread': [0],
'no-var': [0], 'prefer-template': [0],
'object-shorthand': [0], 'require-yield': [0],
'prefer-arrow-callback': [0], 'rest-spread-spacing': [0],
'prefer-const': [0], 'sort-imports': [0],
'prefer-reflect': [0], 'template-curly-spacing': [0],
'prefer-rest-params': [0], 'yield-star-spacing': [0],
'prefer-spread': [0], },
'prefer-template': [0], }
'require-yield': [0],
'rest-spread-spacing': [0],
'sort-imports': [0],
'template-curly-spacing': [0],
'yield-star-spacing': [0],
},
};

View File

@ -17,7 +17,7 @@
"browser": "./dist/browser/bigchaindb-driver.cjs2.min.js", "browser": "./dist/browser/bigchaindb-driver.cjs2.min.js",
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
"lint": "eslint ./{src,test,examples}/**/*.js", "lint": "eslint .",
"build": "npm run clean && npm run build:cjs && npm run build:dist", "build": "npm run clean && npm run build:cjs && npm run build:dist",
"build:bundle": "webpack", "build:bundle": "webpack",
"build:cjs": "cross-env BABEL_ENV=cjs babel ./src -d dist/node", "build:cjs": "cross-env BABEL_ENV=cjs babel ./src -d dist/node",