2.0.1 • Published 2 years ago

@shopify/loom-plugin-eslint v2.0.1

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

@shopify/loom-plugin-eslint

This package provides a loom plugin that runs ESLint as part of the loom lint command.

This package does not make any assumptions about what version of ESLint or what ruleset you should use. You will need to install eslint as a peerDependency and you will need to configure ESLint yourself. We recommend using the presets provided by @shopify/eslint-plugin.

Installation

yarn add @shopify/loom-plugin-eslint eslint --dev

Usage

Add eslint to your loom worksace plugins.

import {createWorkspace} from '@shopify/loom';
import {eslint} from '@shopify/loom-plugin-eslint';

// `createWorkspace` may be `createPackage`, or `createApp` if your workspace
// consists of a single project
export default createWorkspace((workspace) => {
  workspace.use(eslint());
});

By default ESLint runs over everything in the current folder. You can modify the files that are processed by passing in a files glob to the plugin's options.

export default createWorkspace((workspace) => {
  // Run eslint on a single subfolder
  workspace.use(eslint({files: 'some-subfolder/**/*'}));
});

Running only ESLint when linting

To run only the ESLint linting step, you can use --isolate-step:

loom lint --isolate-step=ESLint

Hooks

This plugin adds the following hooks to LintWorkspaceConfigurationCustomHooks:

  • eslintFlags: an object of options to convert into command line flags for the eslint command. These options are camelcase versions of their CLI counterparts.

    import {createWorkspacePlugin} from '@shopify/loom';
    
    function demoPlugin() {
      return createWorkspacePlugin('Demo', ({tasks: {lint}}) => {
        lint.hook(({hooks}) => {
          hooks.configure.hook((configure) => {
            // Modify the maximum number of allowed warnings from the default of 0
            configure.eslintFlags?.hook((flags) => ({
              ...flags,
              maxWarnings: 5,
            }));
          });
        });
      });
    }
2.0.1

2 years ago

1.0.1

2 years ago

2.0.0

2 years ago

1.0.0

3 years ago

0.6.0-alpha.3

3 years ago

0.6.0-alpha.4

3 years ago

0.6.0-alpha.1

3 years ago

0.6.0-alpha.2

3 years ago

0.6.0-alpha.0

3 years ago

0.5.0

3 years ago