|
4 | 4 | // https://typescript-eslint.io/getting-started#step-2-configuration
|
5 | 5 | // https://typescript-eslint.io/getting-started/typed-linting
|
6 | 6 |
|
7 |
| -import eslint from "@eslint/js" |
8 |
| -import { dirname } from "path" |
9 |
| -import tseslint from "typescript-eslint" |
10 |
| -import { fileURLToPath } from "url" |
| 7 | +// This file must be in CommonJS format ('require()') instead of ESModules ('import') due to how it is consumed |
| 8 | +// by openapi-alps: |
| 9 | +// https://github.com/Azure/openapi-diff/pull/335/files#r1649413983 |
11 | 10 |
|
12 |
| -// Needed to support Node < 20.11 per: |
13 |
| -// https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules |
14 |
| -// as linked from: https://typescript-eslint.io/getting-started/typed-linting |
15 |
| -const __dirname = dirname(fileURLToPath(import.meta.url)) |
| 11 | +const eslint = require("@eslint/js") |
| 12 | +const tseslint = require("typescript-eslint") |
16 | 13 |
|
17 |
| -export default tseslint.config( |
| 14 | +module.exports = tseslint.config( |
18 | 15 | eslint.configs.recommended,
|
19 | 16 | ...tseslint.configs.recommendedTypeChecked,
|
20 | 17 | {
|
21 | 18 | languageOptions: {
|
22 | 19 | parserOptions: {
|
23 | 20 | project: true,
|
| 21 | + // Note: __dirname is coming CommonJS: |
| 22 | + // https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules |
| 23 | + // as linked from: https://typescript-eslint.io/getting-started/typed-linting |
24 | 24 | tsconfigRootDir: __dirname
|
25 | 25 | }
|
26 | 26 | }
|
27 | 27 | },
|
28 | 28 | {
|
29 | 29 | // Based on https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores
|
30 |
| - ignores: ["**/dist"] |
| 30 | + ignores: ["**/dist", "eslint.config.js"] |
31 | 31 | },
|
32 | 32 | {
|
33 | 33 | rules: {
|
|
0 commit comments