@shopify/loom-plugin-eslint v2.0.1
@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 --devUsage
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=ESLintHooks
This plugin adds the following hooks to LintWorkspaceConfigurationCustomHooks:
eslintFlags: an object of options to convert into command line flags for theeslintcommand. 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, })); }); }); }); }
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago