Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-mmkal

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-mmkal

My eslint plugin with rules I find good. If you aren't me you probably shouldn't use this.

  • 0.4.0-13
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
878
increased by129.24%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-mmkal

My eslint plugin with rules I find good. If you aren't me you probably shouldn't use this.

  • Goals
  • Non-goals
  • How to use
  • Notes

Goals

  1. Work out of the box
  2. Cover as many js/ts development use-cases as possible
  3. Be prescriptive about arbitrary rules like formatting
  4. Enforce some degree of consistency
  5. Be opinionated but trusting
  6. Protect against common gotchas
  7. Provide pits of success
  8. Don't require any peer dependencies to work
  9. Be somewhat configurable

Included

The following plugins/libraries are usable and should "just work" without needing to add extra configs. They should also "just work" if you have defined extra configs like .prettierrc.js or tsconfig.json.

  1. Prettier
  2. typescript-eslint
  3. eslint-plugin-unicorn

Non-goals

  1. Small package size
  2. Support non-flat config
  3. Be your mother

How to use

Install with npm install eslint-plugin-mmkal, then in your eslint.config.js:

module.exports = require('eslint-plugin-mmkal').recommendedFlatConfigs

Notes

Prettier is pre-configured

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, you get what I think is a better prettier config than the default.

Common globals are enabled

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,
]

🧪 Disabling configs

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.

Some rules are shimmed

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 shim javascript embedded within a markdown file, thinking that the whole markdown file will be linted. There's a similar shim with unicorn/filename-case.

FAQs

Package last updated on 19 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc