My eslint plugin with rules I find good. If you aren't me, or don't know me, you probably shouldn't use this.
- Work out of the box
- Cover as many js/ts development use-cases as possible
- Be prescriptive about arbitrary rules like formatting
- Enforce some degree of consistency
- Be opinionated but trusting
- Protect against common gotchas
- Provide pits of success
- Don't require any peer dependencies to work
- Be somewhat configurable
The following plugins/libraries are usable and should "just work" without needing to add extra configs.
- prettier
- typescript-eslint
- embedded js/ts in markdown
- eslint-plugin-codegen
- eslint-plugin-unicorn
- eslint-plugin-import
- eslint-plugin-vitest
- eslint-plugin-promise
- @rushstack/eslint-plugin-packlets
- eslint-plugin-react
- eslint-plugin-react-hooks
- @next/eslint-plugin-next
- eslint-plugin-jsx-a11y
There's some effort to make sure the rules only aplly to relevant files, but of course there are many different possible projedt setups.
Not enabled currently but may be soon:
- eslint-plugin-functional
- Small package size
- Support non-flat config
- Be your mother
Install with npm install eslint-plugin-mmkal --save-dev
, then in your eslint.config.js:
module.exports = require('eslint-plugin-mmkal').recommendedFlatConfigs
That is, there are prettier options baked into this package, and the above usage will use them. If you want to rely on the default prettier resolution, just override:
const mmkal = require('eslint-plugin-mmkal')
module.exports = [
...mmkal.recommendedFlatConfigs,
{rules: {'prettier/prettier': 'warn'}},
]
This will rely on prettier's built-in config resolution. The reason this package doesn't do this is so that you can install it in a project without a .prettierrc.js
file, and you get what I think is a better prettier config than the default.
Because the goal of this plugin is to make it quick to write sensible code rather than be 100% sure to prevent you from writing silly code (which no lint library can really achieve), globals for nodejs, browsers, commonjs and es2021 are enabled by default. Use typescript to get compiler errors on undefined globals.
All of the globals in the globals package (which are the official globals eslint uses) are available as configs:
const mmkal = require('eslint-plugin-mmkal')
module.exports = [
...mmkal.recommendedFlatConfigs,
...mmkal.configs.globals_greasemonkey,
]
This is somewhat experimental and might be changed, but there's a jerry-rigged "naming" system that ships with this package to make it easier to disable internal configs (which are pretty modular) if you don't want it:
const mmkal = require('eslint-plugin-mmkal')
module.exports = mmkal.withoutConfigs(mmkal.recommendedFlatConfigs, [
'globals_node',
'prettierPreset',
])
Since this is experimental and subject to change, what the actual names are isn't documented here, but the withoutConfigs
function is strongly typed, so IDE intellisense/autocomplete should hint what you can disable.
There's a rule added to the prettier plugin, prettier/processed
. This is the same as the prettier/prettier
rule but it shims context.physicalFilename
with context.filename
- because the builtin prettier rule refuses to lint javascript embedded within a markdown file, thinking that the whole markdown file will be linted. There's a similar shim with unicorn/filename-case
.