Skip to content

Commit

Permalink
feat: upgrade eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ogiorgis committed Feb 14, 2025
1 parent af80029 commit ceabdb2
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 310 deletions.
65 changes: 0 additions & 65 deletions .eslintrc.js

This file was deleted.

75 changes: 75 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import globals from 'globals';
import babelParser from '@babel/eslint-parser';
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 [
...compat.extends(
'eslint-config-airbnb',
'plugin:prettier/recommended',
'prettier',
'plugin:jest/recommended',
'plugin:jest/style',
),
{
languageOptions: {
globals: {
...globals.browser,
page: true,
browser: true,
jestPuppeteer: true,
},

parser: babelParser,
},
files: ['**/*.js', '**/*.jsx'],
rules: {
'class-methods-use-this': 'off',
'consistent-return': 'off',
'default-case': 'off',
'default-param-last': 'off',
'import/extensions': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'no-alert': 'off',
'no-continue': 'off',
'no-param-reassign': 'off',
'no-plusplus': 'off',
'no-restricted-syntax': 'off',
'no-shadow': 'off',
'no-underscore-dangle': 'off',
'prefer-promise-reject-errors': 'off',
'react/destructuring-assignment': 'off',
'react/function-component-definition': 'off',
'react/jsx-fragments': 'off',
'react/jsx-no-constructed-context-values': 'off',
'react/jsx-no-script-url': 'off',
'react/jsx-no-useless-fragment': 'off',
'react/jsx-props-no-spreading': 'off',
'react/no-arrow-function-lifecycle': 'off',
'react/no-invalid-html-attribute': 'off',
'react/no-namespace': 'off',
'react/no-unstable-nested-components': 'off',
'react/no-unused-class-component-methods': 'off',
'react/prefer-exact-props': 'off',
'react/prop-types': 'off',
'react/sort-comp': [0, {}],

'import/order': [
'error',
{
'newlines-between': 'always',
},
],
},
},
];
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"d3-scale": "4.0.2",
"eslint-formatter-codeframe": "7.32.1",
"fuse.js": "6.0.4",
"globals": "15.15.0",
"history": "4.10.1",
"js-cookie": "3.0.5",
"js-yaml": "4.1.0",
Expand Down Expand Up @@ -72,7 +73,7 @@
},
"devDependencies": {
"@babel/core": "7.26.8",
"@babel/eslint-parser": "7.25.9",
"@babel/eslint-parser": "7.26.8",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/preset-env": "7.26.8",
Expand All @@ -90,11 +91,11 @@
"clean-webpack-plugin": "4.0.0",
"copy-webpack-plugin": "12.0.2",
"css-loader": "7.1.2",
"eslint": "8.21.0",
"eslint": "9.20.1",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jest": "27.1.7",
"eslint-plugin-jest": "28.11.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "7.37.4",
Expand Down Expand Up @@ -123,8 +124,8 @@
"build:dev": "node ./node_modules/webpack/bin/webpack.js --mode development",
"format": "node ./node_modules/prettier/bin-prettier.js --write \"**/*.{css,html,js,jsx,json,md,yaml,yml}\"",
"format:check": "node ./node_modules/prettier/bin-prettier.js --check \"**/*.{css,html,js,jsx,json,md,yaml,yml}\"",
"lint": "node ./node_modules/eslint/bin/eslint.js --report-unused-disable-directives --max-warnings 0 --format codeframe --ext js,jsx \".*.js\" \"*.js\" ui/ tests/ui/",
"lint-with-cache": "node ./node_modules/eslint/bin/eslint.js --cache --report-unused-disable-directives --max-warnings 0 --format codeframe --ext js,jsx \".*.js\" \"*.js\" ui/ tests/ui/",
"lint": "node ./node_modules/eslint/bin/eslint.js --report-unused-disable-directives --max-warnings 0 --format codeframe ui/ tests/ui/",
"lint-with-cache": "node ./node_modules/eslint/bin/eslint.js --cache --report-unused-disable-directives --max-warnings 0 --format codeframe ui/ tests/ui/",
"markdownlint": "node ./node_modules/markdownlint-cli/markdownlint.js -c .markdownlint.json -p .markdownlintignore .",
"prettier": "npx prettier --check .",
"start": "node ./node_modules/webpack/bin/webpack.js serve --mode development",
Expand Down
4 changes: 2 additions & 2 deletions ui/job-view/headerbars/SecondaryNavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class SecondaryNavBar extends React.PureComponent {

// Re-save the list, in case it has now changed
this.saveWatchedRepos(watchedRepoNames);
} catch (e) {
} catch {
// localStorage is disabled/not supported.
return [];
}
Expand All @@ -191,7 +191,7 @@ class SecondaryNavBar extends React.PureComponent {
this.setState({ watchedRepoNames: repos });
try {
localStorage.setItem(WATCHED_REPOS_STORAGE_KEY, JSON.stringify(repos));
} catch (e) {
} catch {
// localStorage is disabled/not supported.
}
}
Expand Down
2 changes: 1 addition & 1 deletion ui/models/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export default class JobModel {
/* eslint-enable no-await-in-loop */

notify(`Request sent to cancel ${jobTerm} via action.json`, 'success');
} catch (e) {
} catch {
notify(`Unable to cancel ${jobTerm}`, 'danger', { sticky: true });
}
}
Expand Down
5 changes: 3 additions & 2 deletions ui/push-health/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';

// Treeherder Styles
import '../css/failure-summary.css';
Expand All @@ -11,4 +11,5 @@ import 'react-tabs/style/react-tabs.css';

import App from './App';

render(<App />, document.getElementById('root'));
const root = createRoot(document.getElementById('root'));
root.render(<App />);
5 changes: 3 additions & 2 deletions ui/taskcluster-auth-callback/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';

import TaskClusterCallback from './TaskclusterCallback';

render(<TaskClusterCallback />, document.getElementById('root'));
const root = createRoot(document.getElementById('root'));
root.render(<TaskClusterCallback />);
Loading

0 comments on commit ceabdb2

Please sign in to comment.