2.2.1 • Published 3 years ago

@onedotprojects/eslint-plugin v2.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@onedotprojects/eslint-plugin

Logo

OneDot' ESLint Style Guide

Adding To A Project

  1. Install the plugin and its dependencies by running:
npm install @onedotprojects/eslint-plugin --save-dev
  1. Add a .eslintrc.js file with the following contents:
"use strict";

/** @file ESLint Configuration file. */

module.exports = {
	extends: ["plugin:@onedotprojects/recommended"],
};
  1. Add overrides for specific files by adding an overrides key:
overrides: [
	{
		extends: ["plugin:@onedotprojects/node"],

		// Node.JS scripts
		files: [],
	},
	{
		extends: ["plugin:@onedotprojects/esm"],

		// ESM files
		files: ["**.mjs","*.mjs"],
	},
	{
		extends: ["plugin:@onedotprojects/cli"],

		// CLIs (including JS GitHub Actions)
		files: ["bin/**.js","bin/*.js", ".github/**.js",".github/*.js"],
	},
	{
		extends: ["plugin:@onedotprojects/config"],

		// Configuration files
		files: ["**.config.js","*.config.js", "**rc.js","*rc.js","**.config.mjs","*.config.mjs", "**rc.mjs","*rc.mjs","**.config.cjs","*.config.cjs", "**rc.cjs","*rc.cjs"],
	},
	{
		extends: ["plugin:@onedotprojects/browser"],

		// Client-side scripts (including HTML files)
		files: ["**.html","*.html", "**.htm","*.htm","**.md/*.html","*.md/*.html"],
	},
	{
		extends: ["plugin:@onedotprojects/sample"],

		// Files including samples (AKA docs) (including HTML and Markdown files)
		files: ["**.md","*.md","**.md/*", "*.md/*"],
	},
],

You can remove any objects that have an empty or unchanged files array.

Make sure that the scripts stay in this order. Otherwise, you may get some false-positive errors.

  1. Add project-specific configuration (such as ecmaVersion). (You should not need to add more rules; it'd probably be better to update the plugin in that case).

  2. Add an npm script to lint your code. It should be named lint:eslint and have the following content:

eslint --fix --cache .
  1. To lint your code, simply run
npm run lint:eslint
  1. The first few times you run npm run lint:eslint, you may see an error ESLint couldn't find the plugin .... If this happens, run the command it suggests.

Congrats! You've successfully integrated ESLint into your project with @onedotprojects/eslint-plugin!

For All

While this was made specifically for OneDot, anyone can use it!

If you have any feedback or require support, please open a discussion and I will get back to you as soon as I can.

Contributing

Feel free to open pull requests, but don't be surprised when we close them. This project rarely changes. However, if you really feel like it should change, open an issue so we can discuss it!

Authors

2.2.1

3 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.3.0

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.0

3 years ago

1.2.2

3 years ago

1.1.3

3 years ago

1.2.1

3 years ago

1.1.1

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.4

3 years ago

1.1.2

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago