1.0.0 • Published 5 years ago

@ufhealth/eslint-config-wp v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@ufhealth/eslint-config-wp

The shareable EcmaScript standard for developing UF Health WordPress projects.

NPM (scoped) Build Status

Key features

  • Based on @ufhealth/eslint-config-standard
  • Allows common globals exposed by WordPress in front-end views and in the editor
  • Includes WordPress-flavored React/JSX support using the wp.element pragma.

Installation & usage

yarn install @ufhealth/eslint-config-wp

Default usage

In your .eslintrc, eslint.config.js or package.json#eslint:

{
  "extends": ["@ufhealth/eslint-config-wp"]
}

By default, this configuration supports the React library bundled with WordPress, exposed as wp.element. If you're writing scripts for the block editor, or enqueueing wp-element for use on the front-end, you don't need to do anything (and we highly recommend you don't).

However, if your script isn't for the editor and you'd like to use a different version of React (or another library like Preact)...

Using a different React library

...no problem! Just change the pragma and version settings accordingly:

{
  "extends": ["@ufhealth/eslint-config-wp"],
  "settings": {
    "react": {
      "pragma": "Preact",
      "version": "8.4"
    }
  }
}

NOTE: You'll need to make sure your .babelrc pragma setting matches whatever you choose, and also make sure you import your respective library wherever you use JSX (this second step isn't required if you're using the wp.element default).