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

Enforce specifying which eslint rule is disabled when using eslint disable comments #650

Merged
merged 2 commits into from
May 23, 2024
Merged
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
14 changes: 10 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "plugin:@wordpress/eslint-plugin/recommended",
"globals": {
"FileReader": true,
"FontFace": true
"env":{
"browser": true
},
"rules": {
"@wordpress/dependency-group": "error",
Expand All @@ -12,8 +11,15 @@
"allowedTextDomain": "create-block-theme"
}
],
"react/jsx-boolean-value": "error"
"react/jsx-boolean-value": "error",
"unicorn/no-abusive-eslint-disable": "error"
},
"ignorePatterns": [
"src/lib"
],
"plugins":[
"unicorn"
],
"overrides": [
{
"files": [ "**/test/**/*.js" ],
Expand Down
237 changes: 237 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@wordpress/scripts": "^26.16.0",
"@wordpress/stylelint-config": "^21.16.0",
"babel-plugin-inline-json-import": "^0.3.2",
"eslint-plugin-unicorn": "^53.0.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"prettier": "npm:wp-prettier@3.0.3",
Expand Down
16 changes: 6 additions & 10 deletions src/editor-sidebar/create-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@
import apiFetch from '@wordpress/api-fetch';
import { store as noticesStore } from '@wordpress/notices';
import {
// eslint-disable-next-line
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalVStack as VStack,
// eslint-disable-next-line
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalSpacer as Spacer,
// eslint-disable-next-line
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalText as Text,
// eslint-disable-next-line
__experimentalHeading as Heading,
// eslint-disable-next-line
__experimentalNavigatorToParentButton as NavigatorToParentButton,
PanelBody,
Button,
TextControl,
Expand Down Expand Up @@ -54,7 +50,7 @@
)
: '',
} );
}, [] );

Check warning on line 53 in src/editor-sidebar/create-panel.js

View workflow job for this annotation

GitHub Actions / Lint

React Hook useSelect has a missing dependency: 'theme'. Either include it or remove the dependency array. You can also do a functional update 'setTheme(t => ...)' if you only need 'theme' in the 'setTheme' call

const cloneTheme = () => {
if ( createType === 'createClone' ) {
Expand All @@ -74,7 +70,7 @@
},
} )
.then( () => {
// eslint-disable-next-line
// eslint-disable-next-line no-alert
alert(
__(
'Theme created successfully. The editor will now reload.',
Expand Down Expand Up @@ -104,7 +100,7 @@
},
} )
.then( () => {
// eslint-disable-next-line
// eslint-disable-next-line no-alert
alert(
__(
'Theme cloned successfully. The editor will now reload.',
Expand Down Expand Up @@ -134,7 +130,7 @@
},
} )
.then( () => {
// eslint-disable-next-line
// eslint-disable-next-line no-alert
alert(
__(
'Child theme created successfully. The editor will now reload.',
Expand Down
10 changes: 3 additions & 7 deletions src/editor-sidebar/create-variation-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ import { useState } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';
import { store as noticesStore } from '@wordpress/notices';
import {
// eslint-disable-next-line
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalVStack as VStack,
// eslint-disable-next-line
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalText as Text,
// eslint-disable-next-line
__experimentalHeading as Heading,
// eslint-disable-next-line
__experimentalNavigatorToParentButton as NavigatorToParentButton,
PanelBody,
Button,
TextControl,
Expand All @@ -36,7 +32,7 @@ export const CreateVariationPanel = () => {
const handleCreateVariationClick = () => {
postCreateThemeVariation( theme.name )
.then( () => {
// eslint-disable-next-line
// eslint-disable-next-line no-alert
alert(
__(
'Theme variation created successfully. The editor will now reload.',
Expand Down
Loading
Loading