Skip to content
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

misc(deps): upgrade to eslint 9 #16327

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
21 changes: 0 additions & 21 deletions .eslintignore

This file was deleted.

120 changes: 0 additions & 120 deletions .eslintrc.cjs

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion clients/.eslintrc.cjs → clients/eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2017 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';


module.exports = {
env: {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';


module.exports = {
extends: '../../../.eslintrc.cjs',
Expand Down
154 changes: 154 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import path from 'node:path';
import {fileURLToPath} from 'node:url';

import localRules from 'eslint-plugin-local-rules';
import _import from 'eslint-plugin-import';
import {fixupPluginRules} from '@eslint/compat';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
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: [
'**/node_modules/**/*',
'**/third_party/**/*',
'**/source-maps/**/*',
'cli/test/fixtures/byte-efficiency/bundle.js',
'**/dist',
'coverage/**/*',
'!**/.eslintrc.cjs',
'core/scripts/legacy-javascript/variants',
'third-party/**/*',
// ignore d.ts files until we can properly lint them
'**/*.d.ts',
'**/*.d.cts',
'**/page-functions-test-case*out*.js',
],
}, ...compat.extends('eslint:recommended', 'google'), {
plugins: {
'local-rules': localRules,
'import': fixupPluginRules(_import),
},

languageOptions: {
globals: {
...globals.node,
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: 'module',

parserOptions: {
ecmaFeatures: {
globalReturn: true,
jsx: false,
},
},
},

rules: {
'import/order': [2, {
'groups': ['builtin', 'external', ['sibling', 'parent'], 'index', 'object', 'type'],
'newlines-between': 'always',
}],

'import/group-exports': 2,
'import/exports-last': 2,
'eqeqeq': 2,

'indent': [2, 2, {
SwitchCase: 1,
VariableDeclarator: 2,

CallExpression: {
arguments: 'off',
},

MemberExpression: 'off',

FunctionExpression: {
body: 1,
parameters: 2,
},

ignoredNodes: [
'ConditionalExpression > :matches(.consequent, .alternate)',
'VariableDeclarator > ArrowFunctionExpression > :expression.body',
'CallExpression > ArrowFunctionExpression > :expression.body',
],
}],

'no-floating-decimal': 2,

'max-len': [2, 100, {
ignorePattern: 'readJson\\(|^import ',
ignoreComments: true,
ignoreUrls: true,
tabWidth: 2,
}],

'no-empty': [2, {
allowEmptyCatch: true,
}],

'no-implicit-coercion': [2, {
boolean: false,
number: true,
string: true,
}],

'no-unused-expressions': [2, {
allowShortCircuit: true,
allowTernary: false,
}],

'no-unused-vars': [2, {
vars: 'all',
args: 'after-used',
argsIgnorePattern: '(^reject$|^_+$)',
varsIgnorePattern: '(^_$|^LH$|^Lantern$|^TraceEngine$|^Protocol$)',
}],

'no-cond-assign': 2,
'space-infix-ops': 2,
'strict': [2, 'global'],
'prefer-const': 2,
'curly': [2, 'multi-line'],

'comma-dangle': [2, {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'never',
}],

'operator-linebreak': ['error', 'after', {
overrides: {
'?': 'ignore',
':': 'ignore',
},
}],

'local-rules/require-file-extension': 2,
'require-jsdoc': 0,
'valid-jsdoc': 0,
'arrow-parens': 0,
},
}, {
files: ['cli/test/smokehouse/test-definitions/*.js'],

rules: {
'max-len': 0,
},
}];
File renamed without changes.
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
"@build-tracker/cli": "^1.0.0-beta.15",
"@esbuild-kit/esm-loader": "^2.1.1",
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
"@eslint/compat": "^1.2.6",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.20.0",
"@formatjs/icu-messageformat-parser": "^2.6.2",
"@jest/fake-timers": "^28.1.0",
"@testing-library/preact": "^3.1.1",
Expand All @@ -129,8 +132,8 @@
"@types/ws": "^7.0.0",
"@types/yargs": "^17.0.8",
"@types/yargs-parser": "^20.2.1",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"@typescript-eslint/eslint-plugin": "^8.24.0",
"@typescript-eslint/parser": "^8.24.0",
"acorn": "^8.5.0",
"angular": "^1.7.4",
"archiver": "^3.0.0",
Expand All @@ -145,7 +148,7 @@
"csv-validator": "^0.0.3",
"es-main": "^1.2.0",
"esbuild": "0.19.11",
"eslint": "^8.4.1",
"eslint": "^9.20.0",
"eslint-config-google": "^0.14.0",
"eslint-formatter-codeframe": "^7.32.1",
"eslint-plugin-import": "^2.25.3",
Expand All @@ -155,6 +158,7 @@
"firebase": "^9.0.2",
"gh-pages": "^2.0.1",
"glob": "^7.1.3",
"globals": "^15.14.0",
"idb-keyval": "2.2.0",
"jest-mock": "^27.3.0",
"jest-snapshot": "^28.1.0",
Expand Down
2 changes: 1 addition & 1 deletion report/.eslintrc.cjs → report/eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';


module.exports = {
env: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';


/**
* eslint does not support ESM rc files, so this must be a .cjs file.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';


/**
* eslint does not support ESM rc files, so this must be a .cjs file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';


module.exports = {
env: {
Expand Down
2 changes: 1 addition & 1 deletion treemap/.eslintrc.cjs → treemap/eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';


module.exports = {
env: {
Expand Down
File renamed without changes.
Loading
Loading