Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@springernature/util-eslint-runner

Package Overview
Dependencies
Maintainers
10
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@springernature/util-eslint-runner

Run ESLint only if Javascript files are found

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
10
Created
Source

ESLint Runner

NPM version Node version LGPL 3.0 licensed

As of ESLint v5 a breaking behaviour change (8b7c6ea) was introduced where a fatal error is thrown if any file pattern returns no files. We would like to use a generic linting implementation on all our component monorepos without having to turn JS linting on/off depending on the presence of Javascript.

This small utility will check for the existence of Javascript files in a repo and then run an npm script command if any are found. The npm script should run your eslint setup.

Install

$ npm install @springernature/util-eslint-runner

Installing util-eslint-runner adds command line exectuables to ./node_modules/.bin/.

Usage

$ ./node_modules/.bin/util-eslint-runner [options]
Options:
  -n --name [string]     NPM script to execute (default: null)
  -p --pattern [string]  Glob pattern to search (default: **/*.js)
  -h, --help             output usage information

.eslintignore

ESLint runner will check for an .eslintignore file, and ignore any patterns it finds.

Example

You always need to specify the --name option, otherwise nothing will run on completion. The default search pattern is **/*.js, which you can override with the --pattern option. Some examples using different options

$ util-eslint-runner --name 'lint-js'
$ util-eslint-runner -n 'lint-js'
$ util-eslint-runner --name 'lint-js' --pattern 'packages/**/*.js'
$ util-eslint-runner -n 'lint-js' -p 'packages/**/*.js'

Example monorepo script setup

Below is an example set of example scripts from a monorepo package.json file:

"scripts": {
  "lint": "util-eslint-runner -n 'lint-js' -p 'packages/**/*.js' && npm run lint-sass",
  "lint-sass": "sass-lint 'packages/**/*.scss'",
  "lint-js": "eslint 'packages/**/*.js'"
}

License

MIT License © 2018, Springer Nature

Keywords

frontend

FAQs

Package last updated on 11 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts