2.3.0 • Published 1 year ago

@madgex/eslint-config-madgex v2.3.0

Weekly downloads
122
License
MIT
Repository
-
Last release
1 year ago

eslint-config-madgex

ESLint rules related to Madgex projects.

Install

npm install eslint@9 @madgex/eslint-config-madgex -save-dev

VSCode extension

Use the official VSCode ESLint Extension v3.0.5+ (you might need to switch to pre-release version)

Usage

⚠️ Recomended to use only 1 type of source file in your repo, either commonjs or module (esm). eslint & eslint-plugin-n (this config depends on) has difficulty supporting both at the same time in a monorepo.

eslint-plugin-n which is a part of our config, reads the package.json for node version, and what type of JS files you use (ESM or commonjs).

// package.json
{
  ...
  "type": "module", // "module" (ESM), or "commonjs" - you cant use both
  {
    "engines": {
      "node": ">=18"
    }
  },
  ...
}

eslint-plugin-n also recognises .npmignore files which will silence warnings of missing dependancies when they are installed as devDependancies.

Node/Browser

// eslint.config.js
import configMadgex from '@madgex/eslint-config-madgex';

export default [...configMadgex];

Vue

config order matters.

// eslint.config.js
import configMadgex from '@madgex/eslint-config-madgex';
import pluginVue from 'eslint-plugin-vue';
// pluginVue.configs['flat/recommended'] has prettier conflicts

export default [...configMadgex, ...pluginVue.configs['flat/essential']];

Rules

Notes regarding specific rules enforced in this config:

  • no-param-reassign - Disallow reassigning function parameters, except for accu which is the accumulator in a .reduce() e.g.

    Array.reduce((accu, key) => {
      accu[key] = getVal(key);
    
      return accu;
    }, {});
  • no-unused-vars - Disallow unused variables, except for request and h as found on hapi.js route handlers.

2.3.0

1 year ago

2.2.0

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.4.1

4 years ago

1.3.1

5 years ago

1.2.7

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2-1

8 years ago

1.0.2-0

8 years ago

1.0.1-5

8 years ago

1.0.1-3

8 years ago

1.0.1-2

8 years ago

1.0.1-1

8 years ago

1.0.1-0

8 years ago

1.0.0

8 years ago