eslint-config-grob
v0.2.0
Published
Shared ESLint configuration based on GROB-NET4Industry frontend coding guidelines, including the embedded grob-style rules.
Readme
eslint-config-grob
Shared ESLint configuration based on GROB-NET4Industry frontend coding guidelines.
Includes the grob-style rules, registered by the config as the plugin grob-style.
Requirements
- Node.js >= 22.13
- ESLint ^10
Installation
npm install --save-dev eslint eslint-config-grobUsage
// eslint.config.js
import { defineConfig } from "eslint/config";
import grobConfig from "eslint-config-grob";
export default defineConfig([
...grobConfig
]);For more information see the official documentation: ESLint shareable config.
Example with ignores and overrides
Real-world setup of the GROB 4portal app, which ignores third-party code and disables the file and folder naming convention for specific files:
// eslint.config.mjs
import grobConfig from "eslint-config-grob";
import { defineConfig, globalIgnores } from "eslint/config";
export default defineConfig([
grobConfig,
// ignore third-party code
globalIgnores([
"./web/js/lib/*",
"./web/dict/*"
]),
// disable KEBAB_CASE for specific files
{
files: [
"./web/**/*.types.js",
"./web/js/release-notes/**",
"./eslint.config.mjs"
],
rules: {
"check-file/filename-naming-convention": "off",
"check-file/folder-naming-convention": "off"
}
},
]);Using only the rules
The embedded plugin is also exported on its own:
import grobStyle from "eslint-config-grob/plugin";
export default [
{
plugins: {"grob-style": grobStyle},
rules: {"grob-style/method-name": "error"}
}
];Rules
| Rule | Description |
|------|-------------|
| grob-style/method-name | method name must be in camelCase |
| grob-style/variable-name-assigned-by-import | default and namespace imports must be PascalCase (not enabled by default) |
| grob-style/variable-name-assigned-by-require | variable assigned by require must be PascalCase |
| grob-style/variable-name-assigned-func | variable assigned a function must be camelCase |
| grob-style/variable-name-jquery-object | variable assigned a jQuery object must start with jq_ |
| grob-style/variable-name-snake-case | other variables must be snake_case |
