eslint-config-reverentgeek
v7.1.13
Published
ESLint rules that ReverentGeek likes :)
Readme
eslint-config-reverentgeek
This package is ReverentGeek's preferred configuration settings for eslint.
Available Configs
| Config | Description |
| ------ | ----------- |
| common | Base configuration with core stylistic and JavaScript rules |
| node | Node.js with CommonJS modules (extends common) |
| node-esm | Node.js with ES modules (extends common) |
| browser | Browser environment with ES modules (extends common) |
| react | Adds JSX parsing support |
| esm | ES modules support |
| blog | 2-space indentation for blog code samples |
Usage
Install dependencies.
npm install --save-dev eslint eslint-config-reverentgeekCreate an
eslint.config.jsfile.Add the following to the config file.
"use strict";
const defineConfig = require( "eslint/config" ).defineConfig; // eslint-disable-line n/no-unpublished-require
const rg = require( "eslint-config-reverentgeek" ); // eslint-disable-line n/no-unpublished-require
module.exports = defineConfig( [
{
extends: [ rg.configs.node ],
rules: {
}
}
] );The node config adds specific support for Node.js and CommonJS modules.
Alternative Configs
The node-esm config adds specific support for Node.js and ES modules (import/export).
import { defineConfig } from "eslint/config"; // eslint-disable-line n/no-unpublished-import
import rg from "eslint-config-reverentgeek"; // eslint-disable-line n/no-unpublished-import
export default defineConfig( {
extends: [ rg.configs["node-esm"] ],
rules: {
}
} );The blog config changes the code style to two-spaced indentations, which is better for copying code samples to blog posts.
import { defineConfig } from "eslint/config";
import rg from "eslint-config-reverentgeek";
export default defineConfig( {
extends: [ rg.configs.browser, rg.configs.blog ]
} );The react config enables JSX parsing. Combine it with the browser config for browser globals and ES module support. If you want React-specific lint rules, add eslint-plugin-react in your own config.
npm install --save-dev eslint-plugin-reactimport { defineConfig } from "eslint/config";
import rg from "eslint-config-reverentgeek";
import react from "eslint-plugin-react";
export default defineConfig( {
extends: [ rg.configs.browser, rg.configs.react ],
plugins: {
react
},
rules: {
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off"
}
} );The browser config sets the browser environment and adds ES module support.
import { defineConfig } from "eslint/config";
import rg from "eslint-config-reverentgeek";
export default defineConfig( {
extends: [ rg.configs.browser ]
} );