@automattic/calypso-eslint-overrides

1.0.0 • Public • Published

@automattic/calypso-eslint-overrides

This package contains ESlint configuration used to override default ESLint settings, grouped by runtime.

The main use case is when a package has code expected to run in a browser, and code expected to run in Node.js.

Usage

Imagine you have an .eslintrc.js that applies some config designed to enforce/prevent some code conventions that won't work well in a browser, or that inherits some rules from a parent .eslintrc.js

module.exports = {
	env: {
		browser: true
	},
	rules: {
		// Polyfill nodejs modules for the browser is expensive, disable them
		'import/no-nodejs-modules': 'error'
	}
}

If there is some section of the code that is meant to be run by Node.js (eg: a ./bin/ directory with some scripts), you can add an override like:

const { nodeConfig } = require('@automattic/calypso-eslint-overrides/node')

module.exports = {
	env: {
		browser: true
	},
	rules: {
		// Polyfill nodejs modules for the browser is expensive, disable them
		'import/no-nodejs-modules': 'error'
	},
	overrides: [
		{
			files: "./bin/**.*"
			...nodeConfig
		}
	]
}

Readme

Keywords

Package Sidebar

Install

npm i @automattic/calypso-eslint-overrides

Weekly Downloads

2

Version

1.0.0

License

GPL-2.0-or-later

Unpacked Size

10.1 kB

Total Files

7

Last publish

Collaborators

  • porada
  • imranh920
  • gmjuhasz
  • rcarvalho
  • briowill
  • bgrgicak
  • dhenridev
  • daledupreez-a8c
  • jeherve
  • yuliyan
  • micbosia8c
  • jeremy.yip
  • wpvip-bot
  • etobiesen
  • kzoschke
  • brunobasto
  • kat3samsin
  • fmfernandes
  • newspack
  • robertsreberski_a8c
  • msurdi-a8c
  • chihsuan
  • manzoorwanijk
  • rjchow
  • andrea-sdl
  • scjr
  • spsiddarthan
  • t2dw4t
  • ehg_
  • wwa
  • sirreal
  • elazzabi
  • royho
  • luismulinari
  • macbre
  • mjangda
  • matticbot
  • a8c
  • blowery
  • noahtallen
  • hanifn
  • sgomes
  • tyxla
  • saroshaga
  • parkcityj
  • nejclovrencic
  • sirbrillig
  • chriszarate
  • robersongomes
  • johngodley