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

Correct the nested structure for eslint config #104

Merged
merged 8 commits into from
Feb 19, 2024

Conversation

ampersarnie
Copy link
Member

@ampersarnie ampersarnie commented Feb 5, 2024

Description

Fixes an issues where ESLint is unable to use the correct rule configurations due to the formatting of the ESLint config file. This meant that some rules such as react/jsx-filename-extension would return falsey reports. In the instance of that rule it would raise that JSX is not to be used in a .js file and should be placed in a .jsx file, contradicting the rules that were in place.

Example Code

// File: src/entrypoints/jsx-test.js

/**
 * A simple example for reproducing incorrect JSX issues
 * in ESLint:
 *  - react/react-in-jsx-scope
 *  - react/jsx-filename-extension
 */
export default () => (
  <div>
    <ul>
      <li>Item 1</li>
      <li>Item 2</li>
      <li>Item 3</li>
    </ul>
  </div>
);

Output Before Fix

// npm run build:dev

ERROR in [eslint]
../wp-content/plugins/my-plugin/src/entrypoints/jsx-test.js
  5:3  error  'React' must be in scope when using JSX        react/react-in-jsx-scope
  5:3  error  JSX not allowed in files with extension '.js'  react/jsx-filename-extension
  6:5  error  'React' must be in scope when using JSX        react/react-in-jsx-scope
  7:7  error  'React' must be in scope when using JSX        react/react-in-jsx-scope
  8:7  error  'React' must be in scope when using JSX        react/react-in-jsx-scope
  9:7  error  'React' must be in scope when using JSX        react/react-in-jsx-scope

Change Log

  • Fixes incorrect nesting of ESLint config.
  • Adds standards plugin to example-site for living documentation and testing.
  • Updates CI to run build for standards plugin specifically.

@ampersarnie ampersarnie marked this pull request as ready for review February 6, 2024 00:08
@ampersarnie ampersarnie merged commit 67fe283 into bigbite:main Feb 19, 2024
3 checks passed
@ampersarnie ampersarnie linked an issue Mar 21, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: eslint config is incorrect
2 participants