|
| 1 | +/*! |
| 2 | +This file is part of CycloneDX SBOM plugin for yarn. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +
|
| 16 | +SPDX-License-Identifier: Apache-2.0 |
| 17 | +Copyright (c) OWASP Foundation. All Rights Reserved. |
| 18 | +*/ |
| 19 | + |
| 20 | +/** |
| 21 | + * @type {import('eslint').Linter.Config} |
| 22 | + * @see https://eslint.org/ |
| 23 | + */ |
| 24 | +module.exports = { |
| 25 | + root: true, |
| 26 | + plugins: [ |
| 27 | + /* see https://github.com/lydell/eslint-plugin-simple-import-sort#readme */ |
| 28 | + 'simple-import-sort', |
| 29 | + /* see https://github.com/Stuk/eslint-plugin-header#readme */ |
| 30 | + 'header' |
| 31 | + ], |
| 32 | + env: { |
| 33 | + commonjs: true, |
| 34 | + node: true |
| 35 | + }, |
| 36 | + rules: { |
| 37 | + // region sort imports/exports |
| 38 | + /** disable other sorters in favour of `simple-import-sort` */ |
| 39 | + 'import/order': 0, |
| 40 | + 'sort-imports': 0, |
| 41 | + /** @see https://github.com/lydell/eslint-plugin-simple-import-sort/ */ |
| 42 | + 'simple-import-sort/imports': 'error', |
| 43 | + 'simple-import-sort/exports': 'error', |
| 44 | + // endregion sort imports/exports |
| 45 | + // region license-header |
| 46 | + /* see https://github.com/Stuk/eslint-plugin-header#readme */ |
| 47 | + 'header/header': ['error', '.license-header.js'] |
| 48 | + // endregion license-header |
| 49 | + }, |
| 50 | + overrides: [ |
| 51 | + { |
| 52 | + files: ['*.spec.*', '*.test.*'], |
| 53 | + env: { |
| 54 | + mocha: true, |
| 55 | + commonjs: true, |
| 56 | + node: true |
| 57 | + } |
| 58 | + }, |
| 59 | + { |
| 60 | + files: ['*.ts'], |
| 61 | + extends: [ |
| 62 | + /** @see https://www.npmjs.com/package/eslint-config-love */ |
| 63 | + 'love' |
| 64 | + ], |
| 65 | + parserOptions: { |
| 66 | + project: './tsconfig.json' |
| 67 | + }, |
| 68 | + rules: { |
| 69 | + /* @see https://typescript-eslint.io/rules/unbound-method/ */ |
| 70 | + '@typescript-eslint/unbound-method': ['error', { |
| 71 | + ignoreStatic: true |
| 72 | + }] |
| 73 | + } |
| 74 | + }, |
| 75 | + { |
| 76 | + files: ['*.js', '*.mjs', '*.cjs'], |
| 77 | + extends: [ |
| 78 | + /* see https://www.npmjs.com/package/eslint-config-standard */ |
| 79 | + 'standard' |
| 80 | + ] |
| 81 | + }, |
| 82 | + { |
| 83 | + files: ['bin/*.js'], |
| 84 | + rules: { |
| 85 | + // region license-header |
| 86 | + /* see https://github.com/Stuk/eslint-plugin-header#readme */ |
| 87 | + 'header/header': 'off' |
| 88 | + // endregion license-header |
| 89 | + } |
| 90 | + } |
| 91 | + ] |
| 92 | +} |
0 commit comments