rollup-plugin-jscc
Version:
Conditional comments and variable replacement for rollup, based on jscc
171 lines (164 loc) • 4.77 kB
JavaScript
const OFF = 0
const WARN = 1
const ON = 2
const YES = true
const noUselessRenameOpts = {
ignoreDestructuring: false,
ignoreImport: false,
ignoreExport: false,
}
module.exports = {
root: YES,
reportUnusedDisableDirectives: YES,
parserOptions: {
impliedStrict: YES,
sourceType: 'module',
},
// https://github.com/sindresorhus/globals/blob/master/globals.json
env: {
node: YES,
es2017: YES,
},
// https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js
extends: ['eslint:recommended'],
rules: {
'accessor-pairs': ON,
'array-callback-return': ON,
'block-scoped-var': ON,
'complexity': [ON, 8], // default is 20
'consistent-return': ON,
'consistent-this': [ON, '_self'],
'dot-notation': WARN,
'eol-last': ON,
'eqeqeq': [ON, 'always', { null: 'ignore' }],
'for-direction': ON,
'func-call-spacing': ON,
'getter-return': ON,
'guard-for-in': WARN,
'handle-callback-err': [ON, '^err(or)?$'],
'keyword-spacing': ON,
'linebreak-style': [ON, 'unix'],
'max-depth': [ON, 3],
'max-len': [1, 120, 4, { ignoreUrls: YES, ignoreRegExpLiterals: YES }],
'max-lines-per-function': [ON, { max: 25, skipBlankLines: YES, skipComments: YES }],
'max-lines': OFF,
'max-nested-callbacks': [ON, 3], // default is 10
'max-params': [ON, 3],
'max-statements': [ON, 12],
'new-cap': [ON, { newIsCap: true, capIsNew: false }],
'new-parens': ON,
'no-alert': ON,
'no-array-constructor': ON,
'no-caller': ON,
'no-catch-shadow': ON,
'no-console': ON,
'no-div-regex': ON,
'no-dupe-args': ON,
'no-dupe-class-members': ON,
'no-dupe-else-if': ON,
'no-dupe-keys': ON,
'no-duplicate-imports': [ON, { includeExports: YES }],
'no-else-return': ON,
'no-empty-pattern': ON,
'no-eval': ON,
'no-ex-assign': ON,
'no-extend-native': ON,
'no-extra-bind': ON,
'no-extra-boolean-cast': ON,
'no-extra-label': ON,
'no-fallthrough': ON,
'no-func-assign': ON,
'no-global-assign': ON,
'no-implicit-globals': ON,
'no-implied-eval': ON,
'no-import-assign': ON,
'no-inner-declarations': [ON, 'functions'],
'no-invalid-regexp': ON,
'no-irregular-whitespace': ON,
'no-iterator': ON,
'no-label-var': ON,
'no-labels': [ON, { allowLoop: false, allowSwitch: false }],
'no-lone-blocks': ON,
'no-lonely-if': ON,
'no-loop-func': ON,
'no-loss-of-precision': WARN,
'no-misleading-character-class': ON,
'no-multi-str': ON,
'no-multiple-empty-lines': [ON, { max: 2 }],
'no-native-reassign': ON,
'no-new-func': ON,
'no-new-object': ON,
'no-new-symbol': ON,
'no-new-wrappers': ON,
'no-new': ON,
'no-obj-calls': WARN,
'no-octal-escape': ON,
'no-octal': ON,
'no-proto': ON,
'no-prototype-builtins': WARN,
'no-redeclare': ON,
'no-regex-spaces': ON,
'no-return-assign': [ON, 'except-parens'],
'no-return-await': ON,
'no-script-url': ON,
'no-self-assign': ON,
'no-self-compare': ON,
'no-sequences': ON,
'no-shadow-restricted-names': ON,
'no-sparse-arrays': ON,
'no-template-curly-in-string': ON,
'no-this-before-super': ON,
'no-throw-literal': ON,
'no-undef-init': ON,
'no-undef': ON,
'no-unmodified-loop-condition': WARN,
'no-unneeded-ternary': [ON, { defaultAssignment: false }],
'no-unreachable': ON,
'no-unsafe-finally': ON,
'no-unsafe-negation': ON,
'no-unused-labels': ON,
'no-useless-backreference': ON,
'no-unused-expressions': WARN,
'no-unused-vars': ON,
'no-use-before-define': [ON, { functions: false }],
'no-useless-call': ON,
'no-useless-computed-key': ON,
'no-useless-concat': ON,
'no-useless-escape': ON,
'no-useless-rename': [ON, noUselessRenameOpts],
'no-useless-return': ON,
'no-var': ON,
'no-void': ON,
'no-whitespace-before-property': ON,
'no-with': ON,
'object-curly-spacing': [ON, 'always'],
'one-var-declaration-per-line': ON,
'one-var': [ON, { initialized: 'never' }],
'prefer-const': [ON, { destructuring: 'all' }],
'prefer-numeric-literals': ON,
'prefer-promise-reject-errors': ON,
'radix': ON,
'require-atomic-updates': ON,
'require-await': ON,
'require-yield': ON,
'strict': [ON, 'never'],
'symbol-description': ON,
'unicode-bom': [ON, 'never'],
'use-isnan': ON,
'valid-typeof': [ON, { requireStringLiterals: true }],
'yoda': [ON, 'never'],
},
overrides: [
{
files: ['**/test/**'],
env: {
mocha: YES,
},
rules: {
'no-console': OFF,
'max-len': OFF,
'max-lines-per-function': OFF,
},
},
],
}