@madgex/eslint-config-madgex 1.3.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +32 -3
  3. package/index.js +23 -64
  4. package/package.json +11 -10
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.0.0](https://github.com/wiley/madgex-eslint-config-madgex/compare/@madgex/eslint-config-madgex@1.4.1...@madgex/eslint-config-madgex@2.0.0) (2024-04-18)
7
+
8
+ -fix!: eslint 9, using modern eslint-plugin-n setup
9
+
6
10
  ## <small>1.3.1 (2020-10-15)</small>
7
11
 
8
12
  - feat: init monorepo ([244a52a](https://thegits/scm/int/eslint-config-madgex/commits/244a52a))
package/README.md CHANGED
@@ -5,15 +5,44 @@
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @madgex/eslint-config-madgex -save-dev
8
+ npm install eslint@9 @madgex/eslint-config-madgex -save-dev
9
9
  ```
10
10
 
11
+ ## VSCode extension
12
+
13
+ Use VSCode Extension v3.0.5+ (you might need to switch to pre-release version)
14
+
11
15
  ## Usage
12
16
 
13
- Extend `@madgex/eslint-config-madgex` in your [.eslintrc.json](https://eslint.org/docs/user-guide/configuring):
17
+ > ⚠️ 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.
14
18
 
15
19
  ```json
20
+ // package.json
21
+ // ESM import/export modules, set to commonjs if you are using `require/module.exports`, you cant use both
22
+ "type": "module",
16
23
  {
17
- "extends": "@madgex/eslint-config-madgex"
24
+ "engines": {
25
+ "node": ">=18"
26
+ }
18
27
  }
19
28
  ```
29
+
30
+ ### Node/Browser
31
+
32
+ ```js
33
+ // eslint.config.js
34
+ import configMadgex from '@madgex/eslint-config-madgex';
35
+ export default [...configMadgex];
36
+ ```
37
+
38
+ ### Vue
39
+
40
+ config order matters.
41
+
42
+ ```js
43
+ // eslint.config.js
44
+ import configMadgex from '@madgex/eslint-config-madgex';
45
+ import pluginVue from 'eslint-plugin-vue';
46
+
47
+ export default [...configMadgex, ...pluginVue.configs['flat/recommended']];
48
+ ```
package/index.js CHANGED
@@ -1,66 +1,25 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es6: true,
5
- node: true,
6
- jest: true,
7
- },
8
- // http://eslint.org/docs/user-guide/configuring#extending-configuration-files
9
- extends: ['airbnb-base', 'plugin:promise/recommended', 'plugin:prettier/recommended'],
10
- plugins: ['prettier'],
11
- rules: {
12
- 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
13
- 'no-console': process.env.NODE_ENV === 'production' ? 2 : 0,
14
- 'no-plusplus': 0,
15
- 'linebreak-style': 0,
16
- 'max-len': [
17
- 'error',
18
- 120,
19
- 2,
20
- {
21
- ignoreUrls: true,
22
- ignoreComments: false,
23
- ignoreRegExpLiterals: true,
24
- ignoreStrings: true,
25
- ignoreTemplateLiterals: true,
26
- },
27
- ],
28
- // disallow reassignment of function parameters
29
- // disallow parameter object manipulation except for specific exclusions
30
- // rule: http://eslint.org/docs/rules/no-param-reassign.html
31
- 'no-param-reassign': [
32
- 'error',
33
- {
34
- props: true,
35
- ignorePropertyModificationsFor: [
36
- 'acc', // for reduce accumulators
37
- 'e', // for e.returnvalue
38
- 'ctx', // for Koa routing
39
- 'req', // for Express requests
40
- 'request', // for Express requests
41
- 'res', // for Express responses
42
- 'response', // for Express responses
43
- '$scope', // for Angular 1 scopes
44
- 'state', // for Vuex mutations
45
- ],
1
+ const globals = require('globals');
2
+ const js = require('@eslint/js');
3
+ const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
4
+ const nodePlugin = require('eslint-plugin-n');
5
+
6
+ module.exports = [
7
+ {
8
+ languageOptions: {
9
+ globals: {
10
+ ...globals.node,
11
+ ...globals.browser,
46
12
  },
47
- ],
48
- // loosely based on Hapi's style guide, extended to break after const|let|var blocks
49
- // https://github.com/hapijs/eslint-config-hapi/blob/master/lib/index.js#L101
50
- 'padding-line-between-statements': [
51
- 'error',
52
- { blankLine: 'always', prev: 'directive', next: '*' },
53
- { blankLine: 'any', prev: 'directive', next: 'directive' },
54
- { blankLine: 'always', prev: 'cjs-import', next: '*' },
55
- { blankLine: 'any', prev: 'cjs-import', next: 'cjs-import' },
56
- { blankLine: 'always', prev: '*', next: 'cjs-export' },
57
- { blankLine: 'any', prev: 'cjs-export', next: '*' },
58
- { blankLine: 'always', prev: 'multiline-block-like', next: '*' },
59
- { blankLine: 'always', prev: 'class', next: '*' },
60
- { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
61
- { blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
62
- { blankLine: 'always', prev: ['case', 'default'], next: '*' },
63
- ],
64
- 'prettier/prettier': 'error',
13
+ },
14
+ },
15
+ js.configs.recommended,
16
+ nodePlugin.configs['flat/recommended'],
17
+ eslintPluginPrettierRecommended,
18
+ {
19
+ rules: {
20
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
21
+ 'no-console': process.env.NODE_ENV === 'production' ? 2 : 0,
22
+ 'prettier/prettier': 'error',
23
+ },
65
24
  },
66
- };
25
+ ];
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@madgex/eslint-config-madgex",
3
- "version": "1.3.1",
3
+ "version": "2.0.0",
4
+ "type": "commonjs",
4
5
  "description": "Madgex ESLint config - based on eslint-config-airbnb",
5
6
  "main": "index.js",
6
7
  "scripts": {
@@ -12,16 +13,16 @@
12
13
  "author": "James Wragg <james.wragg@madgex.com> (https://madgex.com/)",
13
14
  "license": "MIT",
14
15
  "peerDependencies": {
15
- "eslint": "^7.11.0",
16
- "eslint-config-airbnb-base": "^14.2.0",
17
- "eslint-config-prettier": "^6.12.0",
18
- "eslint-plugin-import": "^2.22.1",
19
- "eslint-plugin-prettier": "^3.1.4",
20
- "eslint-plugin-promise": "^4.2.1",
21
- "prettier": "^2.1.2"
16
+ "@eslint/js": ">=9",
17
+ "eslint": ">=9",
18
+ "eslint-config-prettier": "^9.1.0",
19
+ "eslint-plugin-n": "^17.2.1",
20
+ "eslint-plugin-prettier": "^5.1.3",
21
+ "globals": ">=15",
22
+ "prettier": ">=3"
22
23
  },
23
24
  "engines": {
24
- "node": ">= 10"
25
+ "node": ">=18"
25
26
  },
26
- "gitHead": "833f1f0d6bcc09b325ea2ea090543fc3f8617105"
27
+ "gitHead": "2bbdb8be7d056e210ce28579c116e05d2f9362c8"
27
28
  }