Skip to content

Fix bug where eslint crashed openapi-alps due to being in module format instead of CommonJS. Bump to @azure/oad: 0.10.12. #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
// https://typescript-eslint.io/getting-started#step-2-configuration
// https://typescript-eslint.io/getting-started/typed-linting

import eslint from "@eslint/js"
import { dirname } from "path"
import tseslint from "typescript-eslint"
import { fileURLToPath } from "url"
// This file must be in CommonJS format ('require()') instead of ESModules ('import') due to how it is consumed
// by openapi-alps:
// https://github.com/Azure/openapi-diff/pull/335/files#r1649413983

// Needed to support Node < 20.11 per:
// https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules
// as linked from: https://typescript-eslint.io/getting-started/typed-linting
const __dirname = dirname(fileURLToPath(import.meta.url))
const eslint = require("@eslint/js")
const tseslint = require("typescript-eslint")

export default tseslint.config(
module.exports = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
project: true,
// Note: __dirname is coming CommonJS:
// https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules
// as linked from: https://typescript-eslint.io/getting-started/typed-linting
tsconfigRootDir: __dirname
}
}
},
{
// Based on https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores
ignores: ["**/dist"]
ignores: ["**/dist", "eslint.config.js"]
},
{
rules: {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@azure/oad",
"version": "0.10.11",
"version": "0.10.12",
"author": {
"name": "Microsoft Corporation",
"email": "[email protected]",
"url": "https://github.com/Azure/openapi-diff"
},
"description": "OpenApi Specification Diff tool",
"license": "MIT",
"type": "module",
"dependencies": {
"@ts-common/fs": "^0.2.0",
"@ts-common/iterator": "^0.3.6",
Expand Down