Skip to content

Commit

Permalink
[babel][eslint] Remove deprecated babel-eslint, upgrade eslint+pret…
Browse files Browse the repository at this point in the history
…tier deps, removed unused plugins (#6809)

* Remove unused eslint plugin

* Minor upgrades for `eslint` dependencies

* Upgrade `@typescript-eslint` dependencies to latest

* Upgrade eslint & prettier to latest & run `--fix`

+ update prettier configuration per https://github.com/prettier/eslint-plugin-prettier#recommended-configuration

* Remove deprecated `babel-eslint` dependency

- was replaced by `@babel/eslint-parser`, but we can actually just use `@typescript-eslint/parser` instead!
  - just needs a `jsx: true` flag for tests w/ JSX

- update `.parse()` API to include `comment` flag which is needed to get the license rule working again
  + remove unnecessary `parserOptions` for tests

- fix i18n rule throwing because `arguments` is a reserved name

- fix cypress reference rule tests to work on Jest without needing to be commented out

- there's multiple prettier autosave lint fixes on here, apologies for the noise

* Fix failing `yarn build-docs` command

* Skip running tests on `packages/` in CI, but *do* run tests on local eslint rules

- TODO - follow up PR updating EUI's `packages/eslint-plugin` separately

* Fix latest from main
cee-chen authored May 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 43c9bc5 commit 976e603
Showing 282 changed files with 1,897 additions and 2,347 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -31,16 +31,12 @@ module.exports = {
},
extends: [
'plugin:@typescript-eslint/recommended',
// Prettier options need to come last, in order to override other style
// rules.
'prettier/react',
'prettier/standard',
// Prettier options need to come last, in order to override other style rules
'plugin:prettier/recommended',
],
plugins: [
'mocha',
'jsx-a11y',
'prettier',
'local',
'import',
'react',
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -142,13 +142,12 @@
"@types/testing-library__jest-dom": "^5.14.3",
"@types/url-parse": "^1.4.8",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
"argparse": "^2.0.1",
"autoprefixer": "^9.8.6",
"axe-core": "^4.4.1",
"babel-eslint": "^10.1.0",
"babel-jest": "^24.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-add-module-exports": "^1.0.2",
@@ -174,16 +173,15 @@
"dts-generator": "^3.0.0",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.5.0",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"eslint-import-resolver-webpack": "^0.13.0",
"eslint-plugin-import": "^2.22.1",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-webpack": "^0.13.2",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-local": "^1.0.0",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"expose-gc": "^1.0.0",
@@ -206,7 +204,7 @@
"postcss-inline-svg": "^4.1.0",
"postcss-loader": "^7.0.1",
"pre-commit": "^1.2.2",
"prettier": "^2.1.2",
"prettier": "^2.8.8",
"process": "^0.11.10",
"prop-types": "^15.6.0",
"puppeteer": "^5.5.0",
11 changes: 7 additions & 4 deletions scripts/eslint-plugin/css_before_spread_props.test.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@ import rule from './css_before_spread_props.js';
const RuleTester = require('eslint').RuleTester;

const ruleTester = new RuleTester({
parser: require.resolve('babel-eslint'),
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: { ecmaFeatures: { jsx: true } },
});

const valid = [
@@ -190,7 +191,8 @@ const invalid = [
`,
errors: [
{
message: 'restTextColor: CSS props must be declared before spread props.',
message:
'restTextColor: CSS props must be declared before spread props.',
},
{
message: 'restLink: CSS props must be declared before spread props.',
@@ -233,11 +235,12 @@ const invalid = [
`,
errors: [
{
message: 'restSpanProps: CSS props must be declared before spread props.',
message:
'restSpanProps: CSS props must be declared before spread props.',
},
],
},
]
];

ruleTester.run('css_before_spread_props', rule, {
valid,
5 changes: 2 additions & 3 deletions scripts/eslint-plugin/css_logical_properties.test.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import rule from './css_logical_properties.js';
const RuleTester = require('eslint').RuleTester;

const ruleTester = new RuleTester({
parser: require.resolve('babel-eslint'),
parser: require.resolve('@typescript-eslint/parser'),
});

const valid = [
@@ -106,8 +106,7 @@ const invalid = [
errors: [{ messageId: 'preferLogicalShorthand' }],
},
{
code:
'css`padding: ${euiTheme.size.s} ${euiTheme.size.m} ${euiTheme.size.l};`',
code: 'css`padding: ${euiTheme.size.s} ${euiTheme.size.m} ${euiTheme.size.l};`',
errors: [{ messageId: 'preferLogicalShorthand' }],
},
{
2 changes: 1 addition & 1 deletion scripts/eslint-plugin/forward_ref_display_name.test.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import rule from './forward_ref_display_name.js';
const RuleTester = require('eslint').RuleTester;

const ruleTester = new RuleTester({
parser: 'babel-eslint',
parser: require.resolve('@typescript-eslint/parser'),
});

const valid = [
Loading

0 comments on commit 976e603

Please sign in to comment.