| 1 | import ljharb from '@ljharb/eslint-config/flat';
|
|---|
| 2 | import ljharbNodeLatest from '@ljharb/eslint-config/flat/node/latest';
|
|---|
| 3 | import ljharbTests from '@ljharb/eslint-config/flat/tests';
|
|---|
| 4 |
|
|---|
| 5 | export default [
|
|---|
| 6 | {
|
|---|
| 7 | ignores: [
|
|---|
| 8 | '.nyc_output',
|
|---|
| 9 | ],
|
|---|
| 10 | },
|
|---|
| 11 | ...ljharb,
|
|---|
| 12 | {
|
|---|
| 13 | languageOptions: {
|
|---|
| 14 | globals: {
|
|---|
| 15 | DataView: false,
|
|---|
| 16 | Float16Array: false,
|
|---|
| 17 | Float32Array: false,
|
|---|
| 18 | Float64Array: false,
|
|---|
| 19 | Int8Array: false,
|
|---|
| 20 | Int16Array: false,
|
|---|
| 21 | Int32Array: false,
|
|---|
| 22 | Intl: false,
|
|---|
| 23 | Uint8Array: false,
|
|---|
| 24 | Uint8ClampedArray: false,
|
|---|
| 25 | Uint16Array: false,
|
|---|
| 26 | Uint32Array: false,
|
|---|
| 27 | },
|
|---|
| 28 | },
|
|---|
| 29 | rules: {
|
|---|
| 30 | 'array-bracket-newline': 'off',
|
|---|
| 31 | complexity: 'off',
|
|---|
| 32 | eqeqeq: ['error', 'allow-null'],
|
|---|
| 33 | 'func-name-matching': 'off',
|
|---|
| 34 | 'id-length': ['error', { min: 1, max: 40 }],
|
|---|
| 35 | 'max-lines-per-function': 'warn',
|
|---|
| 36 | 'max-params': ['error', 5],
|
|---|
| 37 | 'max-statements': 'warn',
|
|---|
| 38 | 'max-statements-per-line': ['error', { max: 2 }],
|
|---|
| 39 | 'multiline-comment-style': 'off',
|
|---|
| 40 | 'new-cap': 'off',
|
|---|
| 41 | 'no-extra-parens': 'warn',
|
|---|
| 42 | 'no-implicit-coercion': ['error', {
|
|---|
| 43 | boolean: false,
|
|---|
| 44 | number: false,
|
|---|
| 45 | string: true,
|
|---|
| 46 | }],
|
|---|
| 47 | 'no-magic-numbers': 'off',
|
|---|
| 48 | 'sort-keys': 'off',
|
|---|
| 49 | },
|
|---|
| 50 | },
|
|---|
| 51 | {
|
|---|
| 52 | files: ['GetIntrinsic.js'],
|
|---|
| 53 | rules: {
|
|---|
| 54 | 'max-statements': 'off',
|
|---|
| 55 | },
|
|---|
| 56 | },
|
|---|
| 57 | {
|
|---|
| 58 | files: ['operations/*'],
|
|---|
| 59 | rules: {
|
|---|
| 60 | 'max-lines': 'off',
|
|---|
| 61 | },
|
|---|
| 62 | },
|
|---|
| 63 | ...ljharbNodeLatest
|
|---|
| 64 | .filter((c) => !c.files?.some((f) => typeof f === 'function' || f === '**/*.mjs'))
|
|---|
| 65 | .map((c) => ({
|
|---|
| 66 | ...c,
|
|---|
| 67 | files: [
|
|---|
| 68 | 'operations/deltas.js',
|
|---|
| 69 | 'operations/getOps.js',
|
|---|
| 70 | 'operations/spackle.js',
|
|---|
| 71 | 'operations/years.js',
|
|---|
| 72 | ],
|
|---|
| 73 | })),
|
|---|
| 74 | {
|
|---|
| 75 | files: [
|
|---|
| 76 | 'operations/deltas.js',
|
|---|
| 77 | 'operations/getOps.js',
|
|---|
| 78 | 'operations/spackle.js',
|
|---|
| 79 | 'operations/years.js',
|
|---|
| 80 | ],
|
|---|
| 81 | rules: {
|
|---|
| 82 | complexity: 'off',
|
|---|
| 83 | 'func-style': 'off',
|
|---|
| 84 | 'max-lines-per-function': 'off',
|
|---|
| 85 | 'max-nested-callbacks': 'off',
|
|---|
| 86 | 'max-statements': 'off',
|
|---|
| 87 | 'no-magic-numbers': 'off',
|
|---|
| 88 | 'no-throw-literal': 'off',
|
|---|
| 89 | },
|
|---|
| 90 | },
|
|---|
| 91 | ...ljharbTests.map((c) => ({
|
|---|
| 92 | ...c,
|
|---|
| 93 | files: ['test/**'],
|
|---|
| 94 | })),
|
|---|
| 95 | {
|
|---|
| 96 | files: ['test/**'],
|
|---|
| 97 | rules: {
|
|---|
| 98 | 'max-len': 'off',
|
|---|
| 99 | 'max-lines-per-function': 'off',
|
|---|
| 100 | 'no-implicit-coercion': 'off',
|
|---|
| 101 | 'no-invalid-this': 'warn',
|
|---|
| 102 | 'prefer-promise-reject-errors': 'off',
|
|---|
| 103 | },
|
|---|
| 104 | },
|
|---|
| 105 | {
|
|---|
| 106 | files: [
|
|---|
| 107 | '*/Num*ToRawBytes.js',
|
|---|
| 108 | '*/RawBytesToNum*.js',
|
|---|
| 109 | 'helpers/bytesAs*.js',
|
|---|
| 110 | 'helpers/valueToFloat*.js',
|
|---|
| 111 | ],
|
|---|
| 112 | rules: {
|
|---|
| 113 | 'max-lines-per-function': 'off',
|
|---|
| 114 | 'max-statements': 'off',
|
|---|
| 115 | 'no-redeclare': 'warn',
|
|---|
| 116 | 'operator-linebreak': ['error', 'before', {
|
|---|
| 117 | overrides: {
|
|---|
| 118 | '=': 'none',
|
|---|
| 119 | },
|
|---|
| 120 | }],
|
|---|
| 121 | },
|
|---|
| 122 | },
|
|---|
| 123 | {
|
|---|
| 124 | files: ['*/GetSubstitution.js'],
|
|---|
| 125 | rules: {
|
|---|
| 126 | 'max-depth': 'off',
|
|---|
| 127 | },
|
|---|
| 128 | },
|
|---|
| 129 | ];
|
|---|