Skip to content

Commit

Permalink
Update highlight-js to eslint 9.0 (#15092)
Browse files Browse the repository at this point in the history
eslint 9 has breaking changes, and also eslint-plugin-header doesn't
work with it.

See
https://eslint.org/docs/latest/use/configure/migration-guide#migrate-your-config-file

This also creates a src\copyright-template.js file which can be used by
all eslint.config.mjs files when other pieces are updated.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/15092)
  • Loading branch information
StephenWeatherford committed Sep 25, 2024
1 parent 384f3b0 commit ba77f3b
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 279 deletions.
2 changes: 2 additions & 0 deletions src/copyright-template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
49 changes: 0 additions & 49 deletions src/highlightjs/.eslintrc.js

This file was deleted.

60 changes: 60 additions & 0 deletions src/highlightjs/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import notice from "eslint-plugin-notice";
import tsParser from "@typescript-eslint/parser";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: ["out/**/*"],
}, ...compat.extends("eslint:recommended"), {
plugins: {
notice,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2020,
sourceType: "module",

parserOptions: {
project: "./tsconfig.json",
},
},

rules: {
"notice/notice": [
2,
{
"templateFile": "../copyright-template.js",
}
]
}
}, ...compat.extends("plugin:@typescript-eslint/recommended", "plugin:jest/all").map(config => ({
...config,
files: ["**/*.ts"],
})), {
files: ["**/*.ts"],


}, {
files: ["**/*.js"],

languageOptions: {
globals: {
...globals.node,
},
},
}];
Loading

0 comments on commit ba77f3b

Please sign in to comment.