|
| 1 | +const globals = require('globals'); |
| 2 | +const neostandard = require('neostandard'); |
| 3 | +const jsdoc = require('eslint-plugin-jsdoc'); |
| 4 | + |
| 5 | +module.exports = [ |
| 6 | + ...neostandard({ |
| 7 | + semi: true |
| 8 | + }), |
| 9 | + jsdoc.configs['flat/recommended'], |
| 10 | + { |
| 11 | + languageOptions: { |
| 12 | + globals: { |
| 13 | + ...globals.browser, |
| 14 | + sinon: true |
| 15 | + } |
| 16 | + }, |
| 17 | + rules: { |
| 18 | + '@stylistic/indent': ['error', 2, { |
| 19 | + CallExpression: {arguments: 'first'}, |
| 20 | + MemberExpression: 'off', |
| 21 | + SwitchCase: 1, |
| 22 | + VariableDeclarator: 2 |
| 23 | + }], |
| 24 | + '@stylistic/key-spacing': 'off', |
| 25 | + '@stylistic/multiline-ternary': 'off', |
| 26 | + '@stylistic/no-multi-spaces': 'off', |
| 27 | + '@stylistic/object-curly-newline': 'off', |
| 28 | + '@stylistic/object-curly-spacing': 'off', |
| 29 | + '@stylistic/object-shorthand': 'off', |
| 30 | + '@stylistic/operator-linebreak': 'off', |
| 31 | + '@stylistic/padded-blocks': 'off', |
| 32 | + '@stylistic/space-before-function-paren': ['error', {anonymous: 'always', named: 'never'}], |
| 33 | + '@stylistic/spaced-comment': 'off', |
| 34 | + camelcase: 'off', |
| 35 | + 'new-cap': 'off', |
| 36 | + 'no-loss-of-precision': 'off', |
| 37 | + 'no-prototype-builtins': 'off', |
| 38 | + 'no-throw-literal': 'off', |
| 39 | + 'no-unneeded-ternary': 'off', |
| 40 | + 'no-useless-call': 'off', |
| 41 | + 'no-var': 'off', |
| 42 | + 'object-shorthand': 'off', |
| 43 | + 'one-var': 'off', |
| 44 | + yoda: 'off', |
| 45 | + |
| 46 | + } |
| 47 | + }, { |
| 48 | + files: ['examples/**', 'tutorials/**'], |
| 49 | + languageOptions: { |
| 50 | + globals: { |
| 51 | + ...globals.browser, |
| 52 | + $: true, |
| 53 | + CodeMirror: true, |
| 54 | + d3: true, |
| 55 | + geo: true, |
| 56 | + sinon: true |
| 57 | + } |
| 58 | + }, |
| 59 | + rules: { |
| 60 | + } |
| 61 | + }, { |
| 62 | + files: ['tests/**'], |
| 63 | + languageOptions: { |
| 64 | + globals: { |
| 65 | + ...globals.jasmine, |
| 66 | + sinon: true |
| 67 | + } |
| 68 | + }, |
| 69 | + rules: { |
| 70 | + } |
| 71 | + }, { |
| 72 | + files: ['src/**/*.js'], |
| 73 | + plugins: { |
| 74 | + jsdoc, |
| 75 | + }, |
| 76 | + rules: { |
| 77 | + 'jsdoc/check-types': ['warn', { |
| 78 | + unifyParentAndChildTypeChecks: true, |
| 79 | + noDefaults: true |
| 80 | + }], |
| 81 | + 'jsdoc/require-jsdoc': ['error', { |
| 82 | + require: { |
| 83 | + FunctionDeclaration: false, |
| 84 | + MethodDefinition: true, |
| 85 | + ClassDeclaration: true |
| 86 | + } |
| 87 | + }], |
| 88 | + 'jsdoc/check-param-names': 'off', |
| 89 | + 'jsdoc/check-tag-names': 'off', |
| 90 | + 'jsdoc/no-undefined-types': 'off', |
| 91 | + 'jsdoc/require-param-description': 'off', |
| 92 | + 'jsdoc/require-returns-description': 'off', |
| 93 | + 'jsdoc/tag-lines': 'off', |
| 94 | + } |
| 95 | + }, { |
| 96 | + files: ['tutorials/**', 'examples/**', 'tests/**', 'scripts/**', 'plugins/**', 'karma*.*', 'jsdoc/**'], |
| 97 | + rules: { |
| 98 | + 'jsdoc/check-param-names': 'off', |
| 99 | + 'jsdoc/check-tag-names': 'off', |
| 100 | + 'jsdoc/check-types': 'off', |
| 101 | + 'jsdoc/match-description': 'off', |
| 102 | + 'jsdoc/multiline-blocks': 'off', |
| 103 | + 'jsdoc/no-defaults': 'off', |
| 104 | + 'jsdoc/no-multi-asterisks': 'off', |
| 105 | + 'jsdoc/no-undefined-types': 'off', |
| 106 | + 'jsdoc/require-jsdoc': 'off', |
| 107 | + 'jsdoc/require-param': 'off', |
| 108 | + 'jsdoc/require-param-description': 'off', |
| 109 | + 'jsdoc/require-param-type': 'off', |
| 110 | + 'jsdoc/require-returns': 'off', |
| 111 | + 'jsdoc/require-returns-check': 'off', |
| 112 | + 'jsdoc/require-returns-description': 'off', |
| 113 | + 'jsdoc/tag-lines': 'off', |
| 114 | + 'jsdoc/valid-types': 'off', |
| 115 | + } |
| 116 | + }, { |
| 117 | + ignores: [ |
| 118 | + 'src/util/distanceGrid.js', |
| 119 | + 'dist/**', |
| 120 | + 'website/**', |
| 121 | + '**/*.min.js', |
| 122 | + 'jsdoc/template/publish.js', |
| 123 | + 'jsdoc/template/static/**', |
| 124 | + 'jsdoc/template/tmpl/**', |
| 125 | + '_build/**', |
| 126 | + 'docs/_build/**', |
| 127 | + ] |
| 128 | + } |
| 129 | +]; |
0 commit comments