@roots/bud-eslint
TypeScript icon, indicating that this package has built-in type declarations

6.21.0 • Public • Published

bud.js

MIT License npm Follow Roots

@roots/bud-eslint

eslint support for bud.js


Installation

Install @roots/bud-eslint to your project.

Yarn:

yarn add @roots/bud-eslint --dev

npm:

npm install @roots/bud-eslint --save-dev

Configuration

For general information on configuring eslint see the official Eslint user guide.

You can configure Stylelint in two ways:

Using an eslint config file

You can configure eslint using a eslint config file.

bud.js allows for you to write your eslint config in CommonJS, ESM, TypeScript, JSON or YML. This file should be placed in the root of your project or the project ./config directory.

export default {
  extends: [`@roots/bud-eslint/config`],
  rules: { "no-console": `error` },
};

Configuring eslint with bud.eslint

You can configure eslint directly in your bud.js config using the bud.eslint API.

bud.eslint
  .extends([`@roots/eslint-config`])
  .setRules({ "no-console": `error` })
  .setFailOnError(bud.isProduction)
  .setFailOnWarning(false)
  .setFix(true);

Extends

You can extend a eslint config by passing an array of eslint config files to bud.eslint.extends.

bud.eslint.extends([`@roots/bud-eslint/config`]);

Rules

You can set eslint rules by passing an object to bud.eslint.setRules.

bud.eslint.setRules({ "no-descending-specificity": null });

Fail on error

By default, eslint will fail on error in production mode. You can change this behavior by setting bud.eslint.failOnError to false.

bud.eslint.setFailOnError(false);

Fail on warning

By default, eslint will not fail on warning. You can change this behavior by setting bud.eslint.failOnWarning to true.

bud.eslint.setFailOnWarning(true);

Fix

By default, eslint will not fix errors. You can change this behavior by setting bud.eslint.fix to true.

bud.eslint.setFix(true);

Installing the recommended config preset

There is a recommended eslint configuration available for you to use as a starting point.

npm install @roots/eslint-config --save-dev

Once installed you can add it to the extends array in your eslint config:

module.exports = {
  root: true,
  extends: ["@roots/eslint-config"],
};

Contributing

Contributions are welcome from everyone.

We have contribution guidelines to help you get started.

License

@roots/bud-eslint is licensed under MIT.

Community

Keep track of development and community news.

Sponsors

Bud is an open source project and completely free to use.

However, the amount of effort needed to maintain and develop new features and projects within the Roots ecosystem is not sustainable without proper financial backing. If you have the capability, please consider sponsoring Roots.

KM Digital Carrot WordPress.com Worksite Safety Copia Digital Freave

Readme

Keywords

Package Sidebar

Install

npm i @roots/bud-eslint

Weekly Downloads

2,069

Version

6.21.0

License

MIT

Unpacked Size

44.7 kB

Total Files

22

Last publish

Collaborators

  • qwp6t
  • swalkinshaw
  • retlehs
  • log1x
  • kellymears