eslint-config-greenpie
Pretty tough linting configs
This package provides ESLint's shared config that designed to be strict as hell.
Usage
Install the base package with required dependencies:
vp add --save-dev eslint-config-greenpie eslint
Then install additional dependencies depending on your use case:
For oxlint users:
vp add --save-dev oxlint oxlint-tsgolint
For ESLint users:
vp add --save-dev @stylistic/eslint-plugin
For TypeScript projects:
vp add --save-dev typescript-eslint
For Vue.js projects:
vp add --save-dev eslint-plugin-vue
Oxlint configuration
If using oxlint, create a .oxlintrc.jsonc file in the root of your project with the following content:
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": [
"./node_modules/eslint-config-greenpie/configs/oxlintrc.jsonc"
]
}
Vitest rules are included in the shared Oxlint config through the package's internal configs/oxlintrc.vitest.jsonc addon, so the consumer setup stays at a single extends entry.
Note: The internal Vitest addon currently applies to
**/*.test.tsand**/__tests__/**/*.ts.
Oxlint CLI
Run oxlint with the following command:
oxlint
If you want Oxlint output in an agent-friendly format, use:
oxlint --format agent
Note: The shared config has
reportUnusedDisableDirectivesenabled by default and does not honoreslint-disable*comments. Useoxlint-disable*comments for Oxlint suppressions. If you are still migrating from ESLint comments, you can override this in your local.oxlintrc.jsonc:{ "options": { "reportUnusedDisableDirectives": "off", "respectEslintDisableDirectives": true } }
ESLint configuration
import { defineConfig } from 'eslint/config';
import { configs } from 'eslint-config-greenpie';
export default defineConfig(
...configs.default,
...configs.vue
);
See more examples below.
Configs (ESLint)
| Config | Description |
|---|---|
default |
Includes js and ts configs |
js |
Includes JavaScript rules |
ts |
Includes TypeScript rules |
vue |
Includes rules for Vue.js |
Type-aware linting (oxlint)
Type-aware linting is enabled by default in this config via options.typeAware: true. This enables powerful type-checking rules like:
no-floating-promises— ensures promises are properly handledno-unsafe-*— prevents unsafe type operations (no-unsafe-argument,no-unsafe-assignment,no-unsafe-call,no-unsafe-member-access,no-unsafe-return)await-thenable— only await thenable valuesno-misused-promises— prevents incorrect promise usage- And many more type-aware rules
To use type-aware rules, install both oxlint and oxlint-tsgolint.
Type-aware linting requires a tsconfig.json file in your project root. Oxlint will automatically discover and use it for type checking.
Configuration examples
Oxlint
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": [
"./node_modules/eslint-config-greenpie/configs/oxlintrc.jsonc"
],
"rules": {
"eslint/no-magic-numbers": "off",
},
"overrides": [{
"files": ["src/**/*.{ts,vue}"],
"env": {
"browser": true
}
}, {
"files": ["vite.config.mts"],
"env": {
"node": true
}
}]
}
JS/TS rules
import { configs } from 'eslint-config-greenpie';
export default [
...configs.js
];
JS + Vue
import { configs } from 'eslint-config-greenpie';
export default [
...configs.js,
...configs.vue
];
JS + TS + Vue
You will probably need to configure another parser for the <script> tag.
import { configs } from 'eslint-config-greenpie';
export default [
...configs.default,
...configs.vue
];
Tips
Allow short identifiers for id-length
The eslint/id-length rule enforces minimum identifier length (default: 2). If your project has legitimate short identifiers, add only those in your local .oxlintrc.jsonc.
{
"extends": [
"./node_modules/eslint-config-greenpie/configs/oxlintrc.jsonc"
],
"rules": {
"eslint/id-length": ["error", {
"max": 40,
"exceptions": [
"t", // translation function, e.g. from vue-i18n
"v" // valibot schema builder, e.g. `v.string()`, `v.object({...})`, etc.
]
}]
}
}
Allow namespace imports for specific packages
The import/no-namespace rule disallows import * as syntax. If you need to use namespace imports for a specific package (e.g. valibot), you can override the rule in your local .oxlintrc.jsonc:
{
"extends": [
"./node_modules/eslint-config-greenpie/configs/oxlintrc.jsonc"
],
"rules": {
"import/no-namespace": ["error", {
"ignore": ["valibot"]
}]
}
}
Links
Development
Running tests
vp run test
Tests use Vitest and the ESLint programmatic API to lint code snippets directly against the configs defined in this repository.
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 17.16.0 | MIT | |
| 17.15.0 | MIT | |
| 17.14.0 | MIT | |
| 17.13.0 | MIT | |
| 17.12.0 | MIT | |
| 17.11.0 | MIT | |
| 17.10.1 | MIT | |
| 17.10.0 | MIT | |
| 17.9.0 | MIT | |
| 17.8.0 | MIT | |
| 17.7.0 | MIT | |
| 17.6.0 | MIT | |
| 17.5.0 | MIT | |
| 17.4.0 | MIT | |
| 17.3.0 | MIT | |
| 17.2.0 | MIT | |
| 17.1.0 | MIT | |
| 17.0.0 | MIT | |
| 16.8.0 | MIT | |
| 16.7.0 | MIT | |
| 16.6.0 | MIT | |
| 16.5.0 | MIT | |
| 16.4.0 | MIT | |
| 16.3.0 | MIT | |
| 16.2.0 | MIT | |
| 16.1.0 | MIT | |
| 16.0.0 | MIT | |
| 15.13.0 | MIT | |
| 15.12.0 | MIT | |
| 15.11.0 | MIT |
Showing the latest 30 of 197. See every release on npm
Pre-releases (36)
| Version | Released | License |
|---|---|---|
| 16.0.0-16 | MIT | |
| 16.0.0-15 | MIT | |
| 16.0.0-14 | MIT | |
| 16.0.0-13 | MIT | |
| 16.0.0-12 | MIT | |
| 16.0.0-11 | MIT | |
| 16.0.0-10 | MIT | |
| 16.0.0-9 | MIT | |
| 16.0.0-8 | MIT | |
| 16.0.0-7 | MIT | |
| 16.0.0-6 | MIT | |
| 16.0.0-5 | MIT | |
| 16.0.0-4 | MIT | |
| 16.0.0-3 | MIT | |
| 16.0.0-2 | MIT | |
| 16.0.0-1 | MIT | |
| 15.0.1-20 | MIT | |
| 15.0.1-19 | MIT | |
| 15.0.1-18 | MIT | |
| 15.0.1-17 | MIT | |
| 15.0.1-15 | MIT | |
| 15.0.1-14 | MIT | |
| 15.0.1-13 | MIT | |
| 15.0.1-11 | MIT | |
| 15.0.1-9 | MIT | |
| 15.0.1-8 | MIT | |
| 15.0.1-3 | MIT | |
| 15.0.1-1 | MIT | |
| 15.0.1-0 | MIT | |
| 15.0.0-0 | MIT |
Showing the latest 30 of 36. See every release on npm