Skip to content

Commit 113ea15

Browse files
authored
chore: migrate to eslint 9 (#459)
* chore: migrate to eslint 9 * chore: bump deps * chore: replace license header script with eslint plugin * chore(deps): oops include package * chore: workaround for broken plugin * chore: downgrade yargs avoid breaking changes
1 parent ea0310b commit 113ea15

File tree

7 files changed

+306
-497
lines changed

7 files changed

+306
-497
lines changed

.eslintrc

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/unit.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@ jobs:
3030
- name: Install dependencies
3131
run: yarn install --frozen-lockfile
3232

33-
- name: Check License Headers
34-
run: yarn check-license-headers
35-
3633
- name: Check formatting
3734
run: yarn format:check
38-
35+
3936
- name: Run linter
4037
run: yarn lint
4138

eslint.config.mjs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { defineConfig } from 'eslint/config';
2+
import js from '@eslint/js';
3+
import globals from 'globals';
4+
import header from 'eslint-plugin-header';
5+
import babelParser from '@babel/eslint-parser';
6+
7+
// Workaround for plugin schema validation failing in eslint v9
8+
// Ref: https://github.com/Stuk/eslint-plugin-header/issues/57#issuecomment-2378485611
9+
header.rules.header.meta.schema = false;
10+
11+
export default defineConfig([
12+
js.configs.recommended,
13+
{
14+
languageOptions: {
15+
globals: {
16+
...globals.node,
17+
...globals.jest,
18+
},
19+
},
20+
plugins: { header },
21+
rules: {
22+
'header/header': [
23+
'error',
24+
'block',
25+
[
26+
'',
27+
{
28+
pattern:
29+
'^ \\* Copyright \\(c\\) \\d{4}, ([sS]alesforce.com, inc|Salesforce, Inc)\\.$',
30+
// This copyright text should match the text used in the rollup config
31+
template: ` * Copyright (c) ${new Date().getFullYear()}, Salesforce, Inc.`,
32+
},
33+
' * All rights reserved.',
34+
' * SPDX-License-Identifier: MIT',
35+
' * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT',
36+
' ',
37+
],
38+
1 /* newline after header */,
39+
],
40+
},
41+
},
42+
{
43+
files: ['src/lightning-stubs/**'],
44+
languageOptions: {
45+
globals: { ...globals.browser },
46+
sourceType: 'module',
47+
// Use babel parser for decorator support
48+
parser: babelParser,
49+
parserOptions: {
50+
requireConfigFile: false,
51+
babelOptions: {
52+
plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
53+
},
54+
},
55+
},
56+
},
57+
]);

package.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
},
2424
"scripts": {
2525
"prepare": "husky install",
26-
"check-license-headers": "node ./scripts/checkLicenseHeaders.js",
2726
"lint": "eslint src/ tests/",
2827
"format": "prettier --write '**/*.{js,json,md,html,css}'",
2928
"format:check": "prettier --check '**/*.{js,json,md,html,css}'",
@@ -50,17 +49,21 @@
5049
"yargs": "~17.7.2"
5150
},
5251
"devDependencies": {
53-
"@babel/core": "^7.26.10",
54-
"@babel/eslint-parser": "^7.27.0",
55-
"@babel/plugin-proposal-decorators": "^7.25.9",
56-
"eslint": "^7.32.0",
52+
"@babel/core": "^7.28.4",
53+
"@babel/eslint-parser": "^7.28.4",
54+
"@babel/plugin-proposal-decorators": "^7.28.0",
55+
"@eslint/eslintrc": "^3.3.1",
56+
"@eslint/js": "^9.36.0",
57+
"eslint": "^9.36.0",
58+
"eslint-plugin-header": "^3.1.1",
59+
"globals": "^16.4.0",
5760
"husky": "^9.1.7",
58-
"isbinaryfile": "^5.0.4",
61+
"isbinaryfile": "^5.0.6",
5962
"lint-staged": "^16.2.3",
60-
"prettier": "^3.3.3"
63+
"prettier": "^3.6.2"
6164
},
6265
"volta": {
63-
"node": "20.12.1",
66+
"node": "20.19.5",
6467
"yarn": "1.22.22"
6568
},
6669
"lint-staged": {

scripts/checkLicenseHeaders.js

Lines changed: 0 additions & 147 deletions
This file was deleted.

src/log.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
*/
77
'use strict';
88

9-
/* eslint-disable no-console */
10-
119
function blue(message) {
1210
// equivalent to chalk.blue()
1311
return `\x1B[34m${message}\x1B[39m`;

0 commit comments

Comments
 (0)