@onedotprojects/eslint-plugin v2.2.1
@onedotprojects/eslint-plugin
OneDot' ESLint Style Guide
Adding To A Project
- Install the plugin and its dependencies by running:
npm install @onedotprojects/eslint-plugin --save-dev
- Add a .eslintrc.js file with the following contents:
"use strict";
/** @file ESLint Configuration file. */
module.exports = {
extends: ["plugin:@onedotprojects/recommended"],
};
- 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.
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).Add an npm script to lint your code. It should be named
lint:eslint
and have the following content:
eslint --fix --cache .
- To lint your code, simply run
npm run lint:eslint
- The first few times you run
npm run lint:eslint
, you may see an errorESLint 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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago