Skip to content

mulekick/muleslint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My ESLint config for Javascript, Typescript, React and Node 🚀

GitHub package.json version GitHub License Last Commit NPM Version NPM Downloads Socket Badge

I use the ESLint extension on Visual Studio code in my day-to day coding activities. I find ESLint to be of a great help to write some proper, clean-cut ES6 code, avoid errors and enforce best practices. Here is the configuration I use to lint my *.js, *.ts, *.jsx and *.tsx files, available as a shareable config.

How I use ESLint in my dev environment

  • Windows 10 x64, Hyper-V enabled.
  • Debian Bookworm running in a Hyper-V VM.
  • Node.js v20.17.0 LTS on Debian.
  • VSCode targeting Debian through SSH.
  • ESLint v8.57.1 installed globally.
  • VSCode ESLint extension enabled.
  • @mulekick/eslint-config-muleslint included in the project's dev dependencies.
  • A minimal eslint.config.js file included in the project's root folder :
import muleslint from "@mulekick/eslint-config-muleslint";
// eslint-disable-next-line node/no-missing-import
import typescript from "typescript-eslint";

// .eslintignore doesn't work with flat configs
export default typescript.config(...muleslint, {
    ignores: [ `**/node_modules/**`, `**/dist/**`, `**/build/**` ]
});

Use it in your own project

  • Install with npx install-peerdeps --dev @mulekick/eslint-config-muleslint.
  • Be sure to add the above eslint.config.js file in your project's root folder.

Configuration details

  • This configuration uses the new eslint flat config format.
  • It extends the following configurations :
configuration description
eslint.configs.recommended core eslint recommended configuration
stylistic.configs.recommended recommended configuration for stylistic-related eslint rules
typescript.configs.strictTypeChecked typescript-eslint strict configuration with type-checked linting enabled 🤖
react.configs.recommended recommended configuration from the eslint react plugin
plugin:node/recommended recommended configuration from the eslint node plugin
plugin:import/recommended recommended configuration from the eslint import plugin
plugin:security/recommended recommended configuration from the eslint security plugin
  • It also uses the html plugin to lint JS code in HTML pages <script> tags.
  • Quite a few of the eslint.configs.recommended and stylistic.configs.recommended options are overriden 😁
  • The use of modern ECMA features (ES6 and beyond) is enforced whenever possible.
  • The use of Crockford indentation (4 spaces) and unix-style line breaks is enforced as well.
  • ESM modules use is enforced too, therefore making strict mode mandatory everywhere 👍