🥜
Peanut for Wordpress
  • Introducing Peanut for Wordpress!
  • Getting Started
    • Quickstart
    • Coding Examples
    • CLI Reference
  • Building Elements
    • Components
    • Blocks
    • Plugins
    • Themes
  • Configuration
    • JSON Configuration
    • Webpack
    • ESLint
    • Wordpress
  • Whiteboard
    • Tutorial
  • Framework
    • Javascript SDK
    • REST API
  • SWP Labs
    • About Us
    • Support Us
Powered by GitBook
On this page
  • Extending the ESLint configuration
  • Example ESLint custom configuration
  1. Configuration

ESLint

PreviousWebpackNextWordpress

Last updated 7 months ago

Extending the ESLint configuration

By creating a custom ESLint configuration "extension" file in your project's elements source root directory, you can customize the settings and options that the application uses when linting files.

First, create a new Javascript file in your project's root directory. The filename can be of your choosing. (for example, "eslint.js")

Next, you will need to set the "PFWP_CONFIG_ESLINT" environment variable in your project's peanut.config.json file to match the name of that extension file you created above:

{
    "PFWP_CONFIG_ESLINT" : "eslint.js"
}

Finally, your Javascript file should export a function as the default. The function receives an object as it's parameter. The object that's passed in contains the default ESLint configuration as a property: eslintConfig. The function must return that config object.

You can modify that object within your exported function to change the ESLint configuration. (See example below.)

Example ESLint custom configuration