Skip to content

Commit

Permalink
Fix exclusion in rollup-plugin-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
onigoetz committed Feb 10, 2021
1 parent 3f37cbc commit 6916156
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/crafty-preset-eslint/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports = {
options: {
overrideConfigFile: toTempFile(crafty.config.eslint),
throwOnError: crafty.getEnvironment() === "production",
exclude: ["node_modules/**"],
exclude: [/node_modules/],
include: crafty.config.eslintExtensions.map(
extension => new RegExp(`\.${extension}$`)
)
Expand Down
15 changes: 7 additions & 8 deletions packages/rollup-plugin-eslint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@

[Rollup](https://github.com/rollup/rollup) plugin to verify entry point and all imported files with ESLint.

> This plugin is a fork of [rollup-plugin-eslint](https://www.npmjs.com/package/rollup-plugin-eslint) with a few differences
> 1. It's compatible with ESLint 7
> 2. Linting is done on all files and a single report is printed at the end of the run
> this allows to lint all files and not fail after the first one.
> This plugin is a fork of [rollup-plugin-eslint](https://www.npmjs.com/package/@rollup/plugin-eslint) with one difference
> Linting is done on all files and a single report is printed at the end of
> the run this allows to lint all files and not fail after the first one.
## Install

```sh
yarn add rollup-plugin-eslint --dev
yarn add @swissquote/rollup-plugin-eslint --dev
```

## Usage

```js
import { rollup } from "rollup";
import eslint from "rollup-plugin-eslint";
import eslint from "@swissquote/rollup-plugin-eslint";

export default {
input: "main.js",
Expand Down Expand Up @@ -65,8 +64,8 @@ A single file, or array of files, to include when linting.

### exclude

Type: `array` or `string`
Default: `node_modules/**`
Type: `array` or `string` or RegExp
Default: `/node_modules/`

A single file, or array of files, to exclude when linting.

Expand Down
5 changes: 3 additions & 2 deletions packages/rollup-plugin-eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function getConfiguration(options) {
module.exports = function eslintPlugin(options = {}) {
const {
include,
exclude = "node_modules/**",
exclude = /node_modules/,
formatter = "stylish",
throwOnWarning,
throwOnError,
Expand All @@ -48,7 +48,8 @@ module.exports = function eslintPlugin(options = {}) {

async transform(code, id) {
const file = normalizePath(id);
if ((await eslint.isPathIgnored(file)) || !filter(file)) {

if (!filter(file) || await eslint.isPathIgnored(file)) {
return;
}

Expand Down

0 comments on commit 6916156

Please sign in to comment.