3.2.0 • Published 8 days ago

@dotcom-tool-kit/lint-staged-npm v3.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 days ago

@dotcom-tool-kit/lint-staged-npm

A plugin to install the lint-staged tool into your package.json using hooks.

Installation

With Tool Kit already set up, install this plugin as a dev dependency:

npm install --save-dev @dotcom-tool-kit/lint-staged-npm

And add it to your repo's .toolkitrc.yml:

plugins:
    - '@dotcom-tool-kit/lint-staged-npm'

Accepting staged files

lint-staged passes the files that you have staged in your git index, filtered by the glob in your lint-staged config, as arguments to the executable you've specified in your config. For example, if you have staged src/example.js, test/example.js, and readme.md in your git index, and you have lint-staged configured to run prettier --write for any files matching the **/*.js glob, lint-staged will invoke prettier --write src/example.js test/example.js. Typically, all command line arguments to dotcom-tool-kit will be interpreted as additional hooks to be run, but any arguments after an -- escape switch will instead be parsed as file paths which are passed as arguments to all tasks associated with the specified hooks. For example, you can invoke multiple hooks by passing them all as arguments, such as dotcom-tool-kit format:staged test:staged. lint-staged will pass any staged files as additional arguments, like dotcom-tool-kit format:staged src/index.js, but Tool Kit will interpret src/index.js as a hook name. Instead we want to call dotcom-tool-kit format:staged -- src/index.js, so we include the -- argument when configuring lint-staged, and any arguments afterwards will be interpreted as file paths and passed as a files argument to tasks. Therefore, any tasks that are expected to be used with lint-staged should be able to accept this files string array in their run() method so that their task can be filtered to only run over files that have been staged in git.

Options

KeyDescriptionDefault value
testGlobthe glob for which staged files should be passed to the test:staged hook'**/*.js'
formatGlobthe glob for which staged files should be passed to the format:staged hook'**/*.js'

Hooks

EventDescriptionInstalled to...Default Tasks
test:stagedrun tests on staged files via git hooklint-staged config field in package.jsonEslint
format:stagedformat staged files via git hooklint-staged config field in package.jsonPrettier
4.0.0-beta.2

8 days ago

4.0.0-beta.1

9 days ago

4.0.0-beta.0

9 days ago

3.2.0

4 months ago

3.1.6

5 months ago

3.1.3

10 months ago

3.1.5

7 months ago

3.1.4

8 months ago

3.1.2

11 months ago

3.1.1

12 months ago

3.0.0

1 year ago

2.0.15

1 year ago

2.0.16

1 year ago

2.0.14

1 year ago

3.1.0

1 year ago

2.0.17

1 year ago

2.0.18

1 year ago

2.0.13

1 year ago

2.0.11

1 year ago

2.0.12

1 year ago

2.0.10

1 year ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.8.2

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.9.0

2 years ago

1.7.0

2 years ago

1.8.4-beta.1

2 years ago

1.8.4

2 years ago

1.8.3

2 years ago

1.7.0-beta.0

2 years ago

1.7.0-beta.3

2 years ago

1.7.0-beta.4

2 years ago

1.7.0-beta.1

2 years ago

1.7.0-beta.2

2 years ago

1.6.2

2 years ago

1.7.0-beta.5

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.6.0-beta.4

2 years ago

1.6.0-beta.3

2 years ago

1.5.2

2 years ago

1.4.3

2 years ago

1.5.1

2 years ago

1.4.2

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.2.3

2 years ago

1.4.0

2 years ago

1.2.2

2 years ago

1.3.0

2 years ago

1.0.2-beta.17

2 years ago

1.0.2-beta.18

2 years ago

1.0.2-beta.15

2 years ago

1.0.2-beta.16

2 years ago

1.0.2-beta.13

2 years ago

1.0.2-beta.14

2 years ago

1.0.2-beta.11

2 years ago

1.0.2-beta.12

2 years ago

1.0.2-beta.2

2 years ago

1.6.0-beta.1

2 years ago

1.0.2-beta.10

2 years ago

1.0.2-beta.3

2 years ago

1.6.0-beta.2

2 years ago

1.0.2-beta.1

2 years ago

1.0.2-beta.7

2 years ago

1.0.2-beta.4

2 years ago

1.0.2-beta.5

2 years ago

1.0.2-beta.8

2 years ago

1.0.2-beta.9

2 years ago

1.2.1

2 years ago

1.2.0

3 years ago