|
| 1 | +/*! |
| 2 | +This file is part of CycloneDX JavaScript Library. |
| 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 | +import path from 'node:path' |
| 21 | +import { fileURLToPath } from 'node:url' |
| 22 | + |
| 23 | +import baseCfg, { globals } from '../tools/code-style/eslint.config.mjs' |
| 24 | + |
| 25 | +const __filename = fileURLToPath(import.meta.url) |
| 26 | +const __dirname = path.dirname(__filename) |
| 27 | + |
| 28 | +/* eslint-disable jsdoc/valid-types -- type-import not supported yet */ |
| 29 | + |
| 30 | +/** |
| 31 | + * @type {import('../tools/code-style/node_modules/eslint').Linter.Config[]} |
| 32 | + * @see https://eslint.org/ |
| 33 | + */ |
| 34 | +export default [ |
| 35 | + ...baseCfg, , |
| 36 | + { |
| 37 | + files: ['./**/*.{js,mjs,cjs,ts}'], |
| 38 | + rules: { |
| 39 | + 'no-console': 'off' |
| 40 | + }, |
| 41 | + }, |
| 42 | + { |
| 43 | + files: ['./node/**/*.{js,mjs,cjs,ts}'], |
| 44 | + rules: { |
| 45 | + '@typescript-eslint/use-unknown-in-catch-callback-variable': 'off' |
| 46 | + }, |
| 47 | + languageOptions: { |
| 48 | + globals: globals.node |
| 49 | + } |
| 50 | + }, |
| 51 | + { |
| 52 | + files: ['./web/*/src/**'], |
| 53 | + languageOptions: { |
| 54 | + globals: globals.browser |
| 55 | + } |
| 56 | + }, |
| 57 | + { |
| 58 | + files: ['./node/typescript/example.cjs/src/*.ts'], |
| 59 | + languageOptions: { |
| 60 | + parserOptions: { |
| 61 | + project: path.join(__dirname, 'node', 'typescript', 'example.cjs', 'tsconfig.json') |
| 62 | + }, |
| 63 | + }, |
| 64 | + }, |
| 65 | + { |
| 66 | + files: ['./node/typescript/example.mjs/src/*.ts'], |
| 67 | + languageOptions: { |
| 68 | + parserOptions: { |
| 69 | + project: path.join(__dirname, 'node', 'typescript', 'example.mjs', 'tsconfig.json' |
| 70 | + ) |
| 71 | + }, |
| 72 | + }, |
| 73 | + }, |
| 74 | + { |
| 75 | + // global ignores must have nothing but a "ignores" property! |
| 76 | + // see https://github.com/eslint/eslint/discussions/17429#discussioncomment-6579229 |
| 77 | + ignores: [ |
| 78 | + '**/dist/', |
| 79 | + ], |
| 80 | + }, |
| 81 | +] |
0 commit comments