|
| 1 | +import * as os from 'os' |
| 2 | +import nodev20 from '@strv/eslint-config-node/v20' |
| 3 | +import nodeopt from '@strv/eslint-config-node/optional' |
| 4 | +import nodestyle from '@strv/eslint-config-node/style' |
| 5 | +import ts from '@strv/eslint-config-typescript' |
| 6 | +import tsoptional from '@strv/eslint-config-typescript/optional' |
| 7 | +import tsstyle from '@strv/eslint-config-typescript/style' |
| 8 | +import mocha from '@strv/eslint-config-mocha' |
| 9 | + |
| 10 | +const lbstyle = os.platform() === 'win32' ? 'windows' : 'unix' |
| 11 | +const globs = { |
| 12 | + mjs: '**/*.mjs', |
| 13 | + ts: '**/*.ts', |
| 14 | + tests: '**/*.test.ts', |
| 15 | +} |
| 16 | + |
| 17 | +/** @type {Array<import("eslint").Linter.FlatConfig>} */ |
| 18 | +const config = [ |
| 19 | + { linterOptions: { |
| 20 | + reportUnusedDisableDirectives: true, |
| 21 | + } }, |
| 22 | + { ignores: ['**/*.js', '**/*.d.ts', 'node_modules'] }, |
| 23 | + { files: [globs.ts, globs.mjs], ...nodev20 }, |
| 24 | + { files: [globs.ts, globs.mjs], ...nodeopt }, |
| 25 | + { files: [globs.ts, globs.mjs], ...nodestyle }, |
| 26 | + |
| 27 | + { files: [globs.ts], ...ts }, |
| 28 | + { files: [globs.ts], ...tsoptional }, |
| 29 | + { files: [globs.ts], ...tsstyle }, |
| 30 | + |
| 31 | + { files: [globs.tests], ...mocha }, |
| 32 | + |
| 33 | + // Any custom settings to be applied |
| 34 | + { files: [globs.ts], |
| 35 | + languageOptions: { |
| 36 | + parserOptions: { project: './tsconfig.json' }, |
| 37 | + }, |
| 38 | + rules: { |
| 39 | + // This repository is configured so that upon checkout, git should convert line endings to platform-specific |
| 40 | + // defaults and convert them back to LF when checking in. As such, we must enforce CRLF endings on Windows, |
| 41 | + // otherwise the lint task would fail on Windows systems. |
| 42 | + 'linebreak-style': ['error', lbstyle], |
| 43 | + } }, |
| 44 | +] |
| 45 | + |
| 46 | +export default config |
0 commit comments