From 435c5e0b0940cbe507a64ccb6981b30010e46707 Mon Sep 17 00:00:00 2001 From: Bryce Osterhaus Date: Mon, 24 Jun 2024 09:43:30 +0400 Subject: [PATCH] chore(eslint-plugin): remove legacy rules for metal --- projects/eslint-plugin/README.md | 170 ++++++------- projects/eslint-plugin/configs/metal.js | 33 --- projects/eslint-plugin/configs/portal.js | 1 - projects/eslint-plugin/index.js | 2 - projects/eslint-plugin/rules/portal/index.js | 1 - .../portal/lib/rules/no-metal-plugins.js | 114 --------- .../tests/lib/rules/no-metal-plugins.js | 231 ------------------ 7 files changed, 78 insertions(+), 474 deletions(-) delete mode 100644 projects/eslint-plugin/configs/metal.js delete mode 100644 projects/eslint-plugin/rules/portal/lib/rules/no-metal-plugins.js delete mode 100644 projects/eslint-plugin/rules/portal/tests/lib/rules/no-metal-plugins.js diff --git a/projects/eslint-plugin/README.md b/projects/eslint-plugin/README.md index c4413435af..b61fa8c9f0 100644 --- a/projects/eslint-plugin/README.md +++ b/projects/eslint-plugin/README.md @@ -8,7 +8,6 @@ | --------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `general` | [eslint:recommended](https://eslint.org/docs/rules/), [prettier](https://github.com/prettier/eslint-config-prettier) | Base configuration, suitable for general projects | | `react` | `general` | `general`, plus rules from [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) and [react-hooks](https://reactjs.org/docs/hooks-rules.html), suitable for projects that use React | -| `metal` | `react` | Like `react`, but turns off rules that cause false positives in [Metal components](http://metaljs.com/) | | `portal` | `react` | Default for projects inside [liferay-portal](https://github.com/liferay/liferay-portal) itself | ## Installation @@ -43,7 +42,7 @@ module.exports = { }; ``` -This preset provides a reasonable starting point for an independent open source project. You can also specify `plugin:@liferay/react`, `plugin:@liferay/metal`, or `plugin:@liferay/portal`. +This preset provides a reasonable starting point for an independent open source project. You can also specify `plugin:@liferay/react`, or `plugin:@liferay/portal`. ### liferay-portal @@ -66,17 +65,6 @@ module.exports = { }; ``` -### metal-jsx - -For legacy projects inside liferay-portal that use [metal-jsx](https://www.npmjs.com/package/metal-jsx), we have a "metal" preset: - -```js -module.exports = { - plugins: ['@liferay'], - extends: ['plugin:@liferay/metal'], -}; -``` - Use this preset to stop ESLint from [spuriously warning that variables that are used as JSX components are unused](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md). ### Copyright headers @@ -115,84 +103,83 @@ If we were to provide configuration by default, then if `bottom-level/.eslintrc. ### Base rules -| Rule or preset | Where we use it | Notes | -| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | -| [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) | @liferay | Preset that turns off ESLint rules that conflict with [Prettier](https://prettier.io/) | -| [eslint:recommended](https://eslint.org/docs/rules/) | @liferay | Preset bundled with [ESLint](https://eslint.org/docs/rules/) | -| [default-case](https://eslint.org/docs/rules/default-case) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | -| [@liferay/portal/deprecation](./rules/portal/docs/rules/deprecation.md) | @liferay/portal | [\#55](https://github.com/liferay/eslint-config-liferay/pull/55) | -| [@liferay/portal/no-explicit-extend](./rules/portal/docs/rules/no-explicit-extend.md) | @liferay/portal | [\#54](https://github.com/liferay/eslint-config-liferay/pull/54) | -| [@liferay/portal/no-global-fetch](./rules/portal/docs/rules/no-global-fetch.md) | @liferay/portal | [\#62](https://github.com/liferay/eslint-config-liferay/pull/62) | -| [@liferay/portal/no-loader-import-specifier](./rules/portal/docs/rules/no-loader-import-specifier.md) | @liferay/portal | [\#122](https://github.com/liferay/eslint-config-liferay/issues/122) | -| [@liferay/portal/no-metal-plugins](./rules/portal/docs/rules/no-metal-plugins.md) | @liferay/portal | [\#61](https://github.com/liferay/eslint-config-liferay/pull/61) | -| [@liferay/portal/no-react-dom-render](./rules/portal/docs/rules/no-react-dom-render.md) | @liferay/portal | [\#71](https://github.com/liferay/eslint-config-liferay/pull/71) | -| [@liferay/portal/no-side-navigation](./rules/portal/docs/rules/no-side-navigation.md) | @liferay/portal | [\#44](https://github.com/liferay/eslint-config-liferay/pull/44) | -| [@liferay/array-is-array](./rules/general/docs/rules/array-is-array.md) | @liferay | [\#139](https://github.com/liferay/eslint-config-liferay/issues/139) | -| [@liferay/destructure-requires](./rules/general/docs/rules/destructure-requires.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | -| [@liferay/empty-line-between-elements](./rules/general/docs/rules/empty-line-between-elements.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | -| [@liferay/expect-assert](./rules/general/docs/rules/expect-assert.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | -| [@liferay/group-imports](./rules/general/docs/rules/group-imports.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [@liferay/import-extensions](./rules/general/docs/rules/import-extensions.md) | @liferay | [\#137](https://github.com/liferay/eslint-config-liferay/issues/137) | -| [@liferay/imports-first](./rules/general/docs/rules/imports-first.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [@liferay/no-abbreviations](./rules/general/docs/rules/no-abbreviations.md) | @liferay | [\#437](https://github.com/liferay/liferay-frontend-projects/issues/437) | -| [@liferay/no-absolute-import](./rules/general/docs/rules/no-absolute-import.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [@liferay/no-anonymous-exports](./rules/general/docs/rules/no-anonymous-exports.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [@liferay/no-arrow](./rules/general/docs/rules/no-arrow.md) | @liferay | [\#179](https://github.com/liferay/eslint-config-liferay/issues/179) | -| [@liferay/no-conditional-object-keys](./rules/general/docs/rules/no-conditional-object-keys.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | -| [@liferay/no-duplicate-class-names](./rules/general/docs/rules/no-duplicate-class-names.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | -| [@liferay/no-duplicate-imports](./rules/general/docs/rules/no-duplicate-imports.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [@liferay/no-dynamic-require](./rules/general/docs/rules/no-dynamic-require.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [@liferay/no-get-data-attribute](./rules/general/docs/rules/no-get-data-attribute.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [@liferay/no-it-should](./rules/general/docs/rules/no-it-should.md) | @liferay | [\#43](https://github.com/liferay/eslint-config-liferay/pull/43) | -| [@liferay/no-length-jsx-expression](./rules/general/docs/rules/no-length-jsx-expression.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | -| [@liferay/no-require-and-call](./rules/general/docs/rules/no-require-and-call.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | -| [@liferay/no-typeof-object](./rules/general/docs/rules/no-typeof-object.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | -| [@liferay/no-use-strict-in-module](./rules/general/docs/rules/no-use-strict-in-module.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | -| [@liferay/padded-test-blocks](./rules/general/docs/rules/padded-test-blocks.md) | @liferay | [\#75](https://github.com/liferay/eslint-config-liferay/pull/75) | -| [@liferay/prefer-length-check](./rules/general/docs/rules/prefer-length-check.md) | @liferay | [\#75](https://github.com/liferay/eslint-config-liferay/pull/75) | -| [@liferay/ref-name-suffix](./rules/general/docs/rules/ref-name-suffix.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [@liferay/sort-class-names](./rules/general/docs/rules/sort-class-names.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | -| [@liferay/sort-import-destructures](./rules/general/docs/rules/sort-import-destructures.md) | @liferay | [\#124](https://github.com/liferay/eslint-config-liferay/issues/124) | -| [@liferay/sort-imports](./rules/general/docs/rules/sort-imports.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [@liferay/trim-class-names](./rules/general/docs/rules/trim-class-names.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | -| [@liferay/use-state-naming-pattern](./rules/general/docs/rules/use-state-naming-pattern.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | -| [no-console](https://eslint.org/docs/rules/no-console) | @liferay | [\#79](https://github.com/liferay/eslint-config-liferay/pull/79) | -| [no-eval](https://eslint.org/docs/rules/no-eval) | @liferay | [\#432](https://github.com/liferay/liferay-frontend-projects/issues/432) | -| [no-for-of-loops/no-for-of-loops](https://www.npmjs.com/package/eslint-plugin-no-for-of-loops) (default: off) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | -| [no-only-tests/no-only-tests](https://www.npmjs.com/package/eslint-plugin-no-only-tests) | @liferay | [\#22](https://github.com/liferay/eslint-config-liferay/pull/22) | -| [no-restricted-globals](https://eslint.org/docs/rules/no-restricted-globals) | @liferay/portal | [\#109](https://github.com/liferay/eslint-config-liferay/issues/109) | -| [no-return-assign](https://eslint.org/docs/rules/no-return-assign) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | -| [no-unused-expressions](https://eslint.org/docs/rules/no-unused-expressions) | @liferay | [\#19](https://github.com/liferay/eslint-config-liferay/issues/19) | -| [no-unused-vars](https://eslint.org/docs/rules/no-unused-vars) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | -| [notice/notice](https://www.npmjs.com/package/eslint-plugin-notice) | @liferay | [\#26](https://github.com/liferay/eslint-config-liferay/pull/26) | -| [object-shorthand](https://eslint.org/docs/rules/object-shorthand) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | -| [prefer-const](https://eslint.org/docs/rules/prefer-const) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | -| [quote-props](https://eslint.org/docs/rules/quote-props) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | -| [radix](https://eslint.org/docs/rules/radix) | @liferay | [\#66](https://github.com/liferay/eslint-config-liferay/pull/66) | -| [react-hooks/exhaustive-deps](https://www.npmjs.com/package/eslint-plugin-react-hooks) | @liferay/react | [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html) | -| [react-hooks/rules-of-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) | @liferay/react | [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html) | -| [react/forbid-foreign-prop-types](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md) | @liferay/react | [\#301](https://github.com/liferay/liferay-npm-tools/issues/301) | -| [react/jsx-curly-brace-presence](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-curly-brace-presence.md) | @liferay/react | [\#421](https://github.com/liferay/liferay-frontend-projects/issues/421) | -| [react/jsx-fragments](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-fragments.md) | @liferay/react | [\#58](https://github.com/liferay/eslint-config-liferay/pull/58) | -| [react/jsx-key](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-key.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/jsx-no-comment-textnodes](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-no-comment-textnodes.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/jsx-no-duplicate-props](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-no-duplicate-props.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/jsx-no-undef](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-no-undef.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/jsx-sort-props](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-sort-props.md) | @liferay/react | [\#58](https://github.com/liferay/eslint-config-liferay/pull/51) | -| [react/jsx-uses-react](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-uses-react.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/jsx-uses-vars](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-uses-vars.md) | @liferay/react, @liferay/metal | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42), [\#50](https://github.com/liferay/eslint-config-liferay/pull/50) | -| [react/no-children-prop](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-children-prop.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/no-danger-with-children](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-danger-with-children.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/no-direct-mutation-state](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-direct-mutation-state.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/no-is-mounted](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-is-mounted.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/no-render-return-value](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-render-return-value.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/no-string-refs](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-string-refs.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/no-unescaped-entities](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unescaped-entities.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/no-unknown-property](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unknown-property.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [react/require-render-return](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/require-render-return.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | -| [sort-destructure-keys/sort-destructure-keys](https://github.com/mthadley/eslint-plugin-sort-destructure-keys) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | -| [sort-keys](https://eslint.org/docs/rules/sort-keys) | @liferay | [\#63](https://github.com/liferay/eslint-config-liferay/pull/63) | -| [spaced-comment](https://eslint.org/docs/rules/spaced-comment) | @liferay | [\#225](https://github.com/liferay/liferay-frontend-projects/issues/225) | +| Rule or preset | Where we use it | Notes | +| --------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) | @liferay | Preset that turns off ESLint rules that conflict with [Prettier](https://prettier.io/) | +| [eslint:recommended](https://eslint.org/docs/rules/) | @liferay | Preset bundled with [ESLint](https://eslint.org/docs/rules/) | +| [default-case](https://eslint.org/docs/rules/default-case) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | +| [@liferay/portal/deprecation](./rules/portal/docs/rules/deprecation.md) | @liferay/portal | [\#55](https://github.com/liferay/eslint-config-liferay/pull/55) | +| [@liferay/portal/no-explicit-extend](./rules/portal/docs/rules/no-explicit-extend.md) | @liferay/portal | [\#54](https://github.com/liferay/eslint-config-liferay/pull/54) | +| [@liferay/portal/no-global-fetch](./rules/portal/docs/rules/no-global-fetch.md) | @liferay/portal | [\#62](https://github.com/liferay/eslint-config-liferay/pull/62) | +| [@liferay/portal/no-loader-import-specifier](./rules/portal/docs/rules/no-loader-import-specifier.md) | @liferay/portal | [\#122](https://github.com/liferay/eslint-config-liferay/issues/122) | +| [@liferay/portal/no-react-dom-render](./rules/portal/docs/rules/no-react-dom-render.md) | @liferay/portal | [\#71](https://github.com/liferay/eslint-config-liferay/pull/71) | +| [@liferay/portal/no-side-navigation](./rules/portal/docs/rules/no-side-navigation.md) | @liferay/portal | [\#44](https://github.com/liferay/eslint-config-liferay/pull/44) | +| [@liferay/array-is-array](./rules/general/docs/rules/array-is-array.md) | @liferay | [\#139](https://github.com/liferay/eslint-config-liferay/issues/139) | +| [@liferay/destructure-requires](./rules/general/docs/rules/destructure-requires.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | +| [@liferay/empty-line-between-elements](./rules/general/docs/rules/empty-line-between-elements.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | +| [@liferay/expect-assert](./rules/general/docs/rules/expect-assert.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | +| [@liferay/group-imports](./rules/general/docs/rules/group-imports.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [@liferay/import-extensions](./rules/general/docs/rules/import-extensions.md) | @liferay | [\#137](https://github.com/liferay/eslint-config-liferay/issues/137) | +| [@liferay/imports-first](./rules/general/docs/rules/imports-first.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [@liferay/no-abbreviations](./rules/general/docs/rules/no-abbreviations.md) | @liferay | [\#437](https://github.com/liferay/liferay-frontend-projects/issues/437) | +| [@liferay/no-absolute-import](./rules/general/docs/rules/no-absolute-import.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [@liferay/no-anonymous-exports](./rules/general/docs/rules/no-anonymous-exports.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [@liferay/no-arrow](./rules/general/docs/rules/no-arrow.md) | @liferay | [\#179](https://github.com/liferay/eslint-config-liferay/issues/179) | +| [@liferay/no-conditional-object-keys](./rules/general/docs/rules/no-conditional-object-keys.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | +| [@liferay/no-duplicate-class-names](./rules/general/docs/rules/no-duplicate-class-names.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | +| [@liferay/no-duplicate-imports](./rules/general/docs/rules/no-duplicate-imports.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [@liferay/no-dynamic-require](./rules/general/docs/rules/no-dynamic-require.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [@liferay/no-get-data-attribute](./rules/general/docs/rules/no-get-data-attribute.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [@liferay/no-it-should](./rules/general/docs/rules/no-it-should.md) | @liferay | [\#43](https://github.com/liferay/eslint-config-liferay/pull/43) | +| [@liferay/no-length-jsx-expression](./rules/general/docs/rules/no-length-jsx-expression.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | +| [@liferay/no-require-and-call](./rules/general/docs/rules/no-require-and-call.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | +| [@liferay/no-typeof-object](./rules/general/docs/rules/no-typeof-object.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | +| [@liferay/no-use-strict-in-module](./rules/general/docs/rules/no-use-strict-in-module.md) | @liferay | [\#94](https://github.com/liferay/eslint-config-liferay/issues/94) | +| [@liferay/padded-test-blocks](./rules/general/docs/rules/padded-test-blocks.md) | @liferay | [\#75](https://github.com/liferay/eslint-config-liferay/pull/75) | +| [@liferay/prefer-length-check](./rules/general/docs/rules/prefer-length-check.md) | @liferay | [\#75](https://github.com/liferay/eslint-config-liferay/pull/75) | +| [@liferay/ref-name-suffix](./rules/general/docs/rules/ref-name-suffix.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [@liferay/sort-class-names](./rules/general/docs/rules/sort-class-names.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | +| [@liferay/sort-import-destructures](./rules/general/docs/rules/sort-import-destructures.md) | @liferay | [\#124](https://github.com/liferay/eslint-config-liferay/issues/124) | +| [@liferay/sort-imports](./rules/general/docs/rules/sort-imports.md) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [@liferay/trim-class-names](./rules/general/docs/rules/trim-class-names.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | +| [@liferay/use-state-naming-pattern](./rules/general/docs/rules/use-state-naming-pattern.md) | @liferay | [\#108](https://github.com/liferay/eslint-config-liferay/issues/108) | +| [no-console](https://eslint.org/docs/rules/no-console) | @liferay | [\#79](https://github.com/liferay/eslint-config-liferay/pull/79) | +| [no-eval](https://eslint.org/docs/rules/no-eval) | @liferay | [\#432](https://github.com/liferay/liferay-frontend-projects/issues/432) | +| [no-for-of-loops/no-for-of-loops](https://www.npmjs.com/package/eslint-plugin-no-for-of-loops) (default: off) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | +| [no-only-tests/no-only-tests](https://www.npmjs.com/package/eslint-plugin-no-only-tests) | @liferay | [\#22](https://github.com/liferay/eslint-config-liferay/pull/22) | +| [no-restricted-globals](https://eslint.org/docs/rules/no-restricted-globals) | @liferay/portal | [\#109](https://github.com/liferay/eslint-config-liferay/issues/109) | +| [no-return-assign](https://eslint.org/docs/rules/no-return-assign) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | +| [no-unused-expressions](https://eslint.org/docs/rules/no-unused-expressions) | @liferay | [\#19](https://github.com/liferay/eslint-config-liferay/issues/19) | +| [no-unused-vars](https://eslint.org/docs/rules/no-unused-vars) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | +| [notice/notice](https://www.npmjs.com/package/eslint-plugin-notice) | @liferay | [\#26](https://github.com/liferay/eslint-config-liferay/pull/26) | +| [object-shorthand](https://eslint.org/docs/rules/object-shorthand) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | +| [prefer-const](https://eslint.org/docs/rules/prefer-const) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | +| [quote-props](https://eslint.org/docs/rules/quote-props) | @liferay | [\#30](https://github.com/liferay/eslint-config-liferay/pull/30) | +| [radix](https://eslint.org/docs/rules/radix) | @liferay | [\#66](https://github.com/liferay/eslint-config-liferay/pull/66) | +| [react-hooks/exhaustive-deps](https://www.npmjs.com/package/eslint-plugin-react-hooks) | @liferay/react | [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html) | +| [react-hooks/rules-of-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks) | @liferay/react | [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html) | +| [react/forbid-foreign-prop-types](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md) | @liferay/react | [\#301](https://github.com/liferay/liferay-npm-tools/issues/301) | +| [react/jsx-curly-brace-presence](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-curly-brace-presence.md) | @liferay/react | [\#421](https://github.com/liferay/liferay-frontend-projects/issues/421) | +| [react/jsx-fragments](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-fragments.md) | @liferay/react | [\#58](https://github.com/liferay/eslint-config-liferay/pull/58) | +| [react/jsx-key](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-key.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/jsx-no-comment-textnodes](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-no-comment-textnodes.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/jsx-no-duplicate-props](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-no-duplicate-props.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/jsx-no-undef](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-no-undef.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/jsx-sort-props](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-sort-props.md) | @liferay/react | [\#58](https://github.com/liferay/eslint-config-liferay/pull/51) | +| [react/jsx-uses-react](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-uses-react.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/jsx-uses-vars](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/jsx-uses-vars.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42), [\#50](https://github.com/liferay/eslint-config-liferay/pull/50) | +| [react/no-children-prop](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-children-prop.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/no-danger-with-children](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-danger-with-children.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/no-direct-mutation-state](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-direct-mutation-state.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/no-is-mounted](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-is-mounted.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/no-render-return-value](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-render-return-value.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/no-string-refs](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-string-refs.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/no-unescaped-entities](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unescaped-entities.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/no-unknown-property](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unknown-property.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [react/require-render-return](https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/require-render-return.md) | @liferay/react | [\#42](https://github.com/liferay/eslint-config-liferay/pull/42) | +| [sort-destructure-keys/sort-destructure-keys](https://github.com/mthadley/eslint-plugin-sort-destructure-keys) | @liferay | [\#60](https://github.com/liferay/liferay-frontend-guidelines/issues/60) | +| [sort-keys](https://eslint.org/docs/rules/sort-keys) | @liferay | [\#63](https://github.com/liferay/eslint-config-liferay/pull/63) | +| [spaced-comment](https://eslint.org/docs/rules/spaced-comment) | @liferay | [\#225](https://github.com/liferay/liferay-frontend-projects/issues/225) | ### Custom rules @@ -241,7 +228,6 @@ The bundled `@liferay/portal` plugin includes the following [rules](./rules/port - [@liferay/portal/no-global-storage](./rules/portal/docs/rules/no-global-storage.md): Prevents usage of unwrapped local/sessionStorage to avoid storing data without consent. - [@liferay/portal/no-loader-import-specifier](./rules/portal/docs/rules/no-loader-import-specifier.md): Ensures that ".scss" files imported via the loader are used only for side-effects. - [@liferay/portal/no-localhost-reference](./rules/portal/docs/rules/no-localhost-reference.md): Enforces that no code should explicitly reference `localhost` as a literal value. -- [@liferay/portal/no-metal-plugins](./rules/portal/docs/rules/no-metal-plugins.md): Prevents usage of deprecated `metal-*` plugins and utilities. - [@liferay/portal/no-react-dom-create-portal](./rules/portal/docs/rules/no-react-dom-create-portal.md): Prevents the direct use of the `ReactDOM.createPortal` API. - [@liferay/portal/no-react-dom-render](./rules/portal/docs/rules/no-react-dom-render.md): Prevents direct usage of `ReactDOM.render` in favor of our wrapper. - [@liferay/portal/no-side-navigation](./rules/portal/docs/rules/no-side-navigation.md): Guards against the use of the legacy jQuery `sideNavigation` plugin. diff --git a/projects/eslint-plugin/configs/metal.js b/projects/eslint-plugin/configs/metal.js deleted file mode 100644 index 08caeb8dfe..0000000000 --- a/projects/eslint-plugin/configs/metal.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * SPDX-FileCopyrightText: © 2017 Liferay, Inc. - * SPDX-License-Identifier: MIT - */ - -'use strict'; - -const config = { - extends: [require.resolve('./react')], - plugins: ['react'], - rules: { - - /** - * @see https://github.com/yannickcr/eslint-plugin-react - */ - - // In Metal, string refs are the only kind of refs. - - 'react/no-string-refs': 'off', - - // In Metal, common property names like "class" will cause this rule to - // fire (because React expects "className"). - - 'react/no-unknown-property': 'off', - }, - settings: { - react: { - version: 'detect', - }, - }, -}; - -module.exports = config; diff --git a/projects/eslint-plugin/configs/portal.js b/projects/eslint-plugin/configs/portal.js index 86012b1829..94e481a3cb 100644 --- a/projects/eslint-plugin/configs/portal.js +++ b/projects/eslint-plugin/configs/portal.js @@ -16,7 +16,6 @@ const config = { '@liferay/portal/no-global-storage': 'error', '@liferay/portal/no-loader-import-specifier': 'error', '@liferay/portal/no-localhost-reference': 'error', - '@liferay/portal/no-metal-plugins': 'error', '@liferay/portal/no-react-dom-create-portal': 'error', '@liferay/portal/no-react-dom-render': 'error', '@liferay/portal/no-side-navigation': 'error', diff --git a/projects/eslint-plugin/index.js b/projects/eslint-plugin/index.js index 0bf6618b72..8befe7c40a 100644 --- a/projects/eslint-plugin/index.js +++ b/projects/eslint-plugin/index.js @@ -4,7 +4,6 @@ */ const generalConfig = require('./configs/general'); -const metalConfig = require('./configs/metal'); const portalConfig = require('./configs/portal'); const reactConfig = require('./configs/react'); const auiRules = require('./rules/aui'); @@ -14,7 +13,6 @@ const portalRules = require('./rules/portal'); module.exports = { configs: { general: generalConfig, - metal: metalConfig, portal: portalConfig, react: reactConfig, }, diff --git a/projects/eslint-plugin/rules/portal/index.js b/projects/eslint-plugin/rules/portal/index.js index 1d9750c3a4..ce81b3f16e 100644 --- a/projects/eslint-plugin/rules/portal/index.js +++ b/projects/eslint-plugin/rules/portal/index.js @@ -12,7 +12,6 @@ module.exports = { 'portal/no-global-storage': require('./lib/rules/no-global-storage'), 'portal/no-loader-import-specifier': require('./lib/rules/no-loader-import-specifier'), 'portal/no-localhost-reference': require('./lib/rules/no-localhost-reference'), - 'portal/no-metal-plugins': require('./lib/rules/no-metal-plugins'), 'portal/no-react-dom-create-portal': require('./lib/rules/no-react-dom-create-portal'), 'portal/no-react-dom-render': require('./lib/rules/no-react-dom-render'), 'portal/no-side-navigation': require('./lib/rules/no-side-navigation'), diff --git a/projects/eslint-plugin/rules/portal/lib/rules/no-metal-plugins.js b/projects/eslint-plugin/rules/portal/lib/rules/no-metal-plugins.js deleted file mode 100644 index c519ba98a3..0000000000 --- a/projects/eslint-plugin/rules/portal/lib/rules/no-metal-plugins.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * SPDX-FileCopyrightText: © 2017 Liferay, Inc. - * SPDX-License-Identifier: MIT - */ - -const DEPRECATED_MODULES = [ - 'metal-affix', - 'metal-ajax', - 'metal-anim', - 'metal-aop', - 'metal-assertions', - 'metal-clipboard', - 'metal-debounce', - 'metal-dom', - 'metal-isomorphic', - 'metal-key', - 'metal-keyboard-focus', - 'metal-multimap', - 'metal-pagination', - 'metal-path-parser', - 'metal-position', - 'metal-promise', - 'metal-router', - 'metal-scrollspy', - 'metal-storage', - 'metal-structs', - 'metal-throttle', - 'metal-toggler', - 'metal-uri', - 'metal-useragent', - 'metal-web-component', -]; - -module.exports = { - create(context) { - return { - ImportDeclaration(node) { - if ( - node.source && - node.source.type === 'Literal' && - DEPRECATED_MODULES.includes(node.source.value) - ) { - context.report({ - messageId: `no-${node.source.value}`, - node, - }); - } - }, - }; - }, - - meta: { - docs: { - category: 'Deprecated APIs', - description: - 'metal-plugins are deprecated; use local utilities instead', - recommended: false, - url: 'https://issues.liferay.com/browse/LPS-96715', - }, - fixable: null, - messages: { - 'no-metal-affix': 'metal-affix is deprecated; use offset instead', - 'no-metal-ajax': - "metal-ajax is deprecated; use `import {fetch} from 'frontend-js-web';` instead", - 'no-metal-anim': - 'metal-anim is deprecated; use `requestAnimationFrame()` instead', - 'no-metal-aop': - "metal-aop is deprecated; use `import {AOP} from 'frontend-js-web';` instead", - 'no-metal-assertions': - 'metal-assertions is deprecated; use `typeof` instead', - 'no-metal-clipboard': - 'metal-clipboard is deprecated; use ClipboardJS instead', - 'no-metal-debounce': - "metal-debounce is deprecated; use `import {debounce} from 'frontend-js-web';` instead", - 'no-metal-dom': - 'metal-dom is deprecated; see https://issues.liferay.com/browse/LPS-122383', - 'no-metal-isomorphic': - 'metal-isomorphic is deprecated; see https://github.com/liferay/liferay-frontend-projects/pull/456', - 'no-metal-key': - 'metal-key is deprecated; use key event handling instead', - 'no-metal-keyboard-focus': - 'metal-keyboard-focus is deprecated; use focus behaviour instead', - 'no-metal-multimap': - 'metal-multimap is deprecated; use Map instead', - 'no-metal-pagination': - 'metal-pagination is deprecated; use https://clayui.com/docs/components/pagination.html', - 'no-metal-path-parser': - 'metal-path-parser is deprecated; use string manipulation instead', - 'no-metal-position': - "metal-position is deprecated; use `import {ALIGN_POSITIONS, align} from 'frontend-js-web';` instead", - 'no-metal-promise': - 'metal-promise is deprecated; use Promise instead', - 'no-metal-router': - 'metal-router is deprecated; see https://github.com/liferay/liferay-frontend-projects/pull/456', - 'no-metal-scrollspy': - 'metal-scrollspy is deprecated; use scroll instead', - 'no-metal-storage': - 'metal-storage is deprecated; use a local implementation instead', - 'no-metal-structs': - 'metal-structs is deprecated; use plain objects instead', - 'no-metal-throttle': - "metal-throttle is deprecated; `import {throttle} from 'frontend-js-web';` instead", - 'no-metal-toggler': - 'metal-toggler is deprecated; use https://clayui.com/docs/components/toggle-switch.html', - 'no-metal-uri': 'metal-uri is deprecated; use URL instead', - 'no-metal-useragent': - 'metal-useragent is deprecated; use `Liferay.Browser` instead', - 'no-metal-web-component': - 'metal-web-component is deprecated; see https://github.com/liferay/liferay-frontend-projects/pull/456', - }, - schema: [], - type: 'problem', - }, -}; diff --git a/projects/eslint-plugin/rules/portal/tests/lib/rules/no-metal-plugins.js b/projects/eslint-plugin/rules/portal/tests/lib/rules/no-metal-plugins.js deleted file mode 100644 index b9eaede9ea..0000000000 --- a/projects/eslint-plugin/rules/portal/tests/lib/rules/no-metal-plugins.js +++ /dev/null @@ -1,231 +0,0 @@ -/** - * SPDX-FileCopyrightText: © 2017 Liferay, Inc. - * SPDX-License-Identifier: MIT - */ - -const MultiTester = require('../../../../../scripts/MultiTester'); -const rule = require('../../../lib/rules/no-metal-plugins'); - -const parserOptions = { - parserOptions: { - ecmaVersion: 6, - sourceType: 'module', - }, -}; - -const ruleTester = new MultiTester(parserOptions); - -ruleTester.run('no-metal-plugins', rule, { - invalid: [ - { - code: "import Affix from 'metal-affix';", - errors: [ - { - messageId: 'no-metal-affix', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import Ajax from 'metal-ajax';", - errors: [ - { - messageId: 'no-metal-ajax', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import Anim from 'metal-anim';", - errors: [ - { - messageId: 'no-metal-anim', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import AOP from 'metal-aop';", - errors: [ - { - messageId: 'no-metal-aop', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import assertBoolean from 'metal-assertions';", - errors: [ - { - messageId: 'no-metal-assertions', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import Clipboard from 'metal-clipboard';", - errors: [ - { - messageId: 'no-metal-clipboard', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import debounce from 'metal-debounce';", - errors: [ - { - messageId: 'no-metal-debounce', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import on from 'metal-dom';", - errors: [ - { - messageId: 'no-metal-dom', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import 'metal-isomorphic';", - errors: [ - { - messageId: 'no-metal-isomorphic', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import KeyboardFocusManager from 'metal-keyboard-focus';", - errors: [ - { - messageId: 'no-metal-keyboard-focus', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import MultiMap from 'metal-multimap';", - errors: [ - { - messageId: 'no-metal-multimap', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import Pagination from 'metal-pagination';", - errors: [ - { - messageId: 'no-metal-pagination', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import Align from 'metal-position';", - errors: [ - { - messageId: 'no-metal-position', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import CancellablePromise from 'metal-promise';", - errors: [ - { - messageId: 'no-metal-promise', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import Router from 'metal-router';", - errors: [ - { - messageId: 'no-metal-router', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import Scrollspy from 'metal-scrollspy';", - errors: [ - { - messageId: 'no-metal-scrollspy', - type: 'ImportDeclaration', - }, - ], - }, - { - code: - "import {LocalStorageMechanism, Storage} from 'metal-storage';", - errors: [ - { - messageId: 'no-metal-storage', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import MultiMap from 'metal-structs';", - errors: [ - { - messageId: 'no-metal-structs', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import throttle from 'metal-throttle';", - errors: [ - { - messageId: 'no-metal-throttle', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import Toggler from 'metal-toggler';", - errors: [ - { - messageId: 'no-metal-toggler', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import URI from 'metal-uri';", - errors: [ - { - messageId: 'no-metal-uri', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import UA from 'metal-useragent';", - errors: [ - { - messageId: 'no-metal-useragent', - type: 'ImportDeclaration', - }, - ], - }, - { - code: "import defineWebComponent from 'metal-web-component';", - errors: [ - { - messageId: 'no-metal-web-component', - type: 'ImportDeclaration', - }, - ], - }, - ], - - valid: [], -});