@madgex/eslint-config-madgex
Advanced tools
Comparing version 1.4.1 to 2.0.0
@@ -6,2 +6,6 @@ # Change Log | ||
# [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) | ||
-fix!: eslint 9, using modern eslint-plugin-n setup | ||
## <small>1.3.1 (2020-10-15)</small> | ||
@@ -8,0 +12,0 @@ |
87
index.js
@@ -1,66 +0,25 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, | ||
jest: true, | ||
}, | ||
// http://eslint.org/docs/user-guide/configuring#extending-configuration-files | ||
extends: ['airbnb-base', 'plugin:promise/recommended', 'plugin:prettier/recommended'], | ||
plugins: ['prettier'], | ||
rules: { | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
'no-console': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
'no-plusplus': 0, | ||
'linebreak-style': 0, | ||
'max-len': [ | ||
'error', | ||
120, | ||
2, | ||
{ | ||
ignoreUrls: true, | ||
ignoreComments: false, | ||
ignoreRegExpLiterals: true, | ||
ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
const globals = require('globals'); | ||
const js = require('@eslint/js'); | ||
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended'); | ||
const nodePlugin = require('eslint-plugin-n'); | ||
module.exports = [ | ||
{ | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
...globals.browser, | ||
}, | ||
], | ||
// disallow reassignment of function parameters | ||
// disallow parameter object manipulation except for specific exclusions | ||
// rule: http://eslint.org/docs/rules/no-param-reassign.html | ||
'no-param-reassign': [ | ||
'error', | ||
{ | ||
props: true, | ||
ignorePropertyModificationsFor: [ | ||
'acc', // for reduce accumulators | ||
'e', // for e.returnvalue | ||
'ctx', // for Koa routing | ||
'req', // for Express requests | ||
'request', // for Express requests | ||
'res', // for Express responses | ||
'response', // for Express responses | ||
'$scope', // for Angular 1 scopes | ||
'state', // for Vuex mutations | ||
], | ||
}, | ||
], | ||
// loosely based on Hapi's style guide, extended to break after const|let|var blocks | ||
// https://github.com/hapijs/eslint-config-hapi/blob/master/lib/index.js#L101 | ||
'padding-line-between-statements': [ | ||
'error', | ||
{ blankLine: 'always', prev: 'directive', next: '*' }, | ||
{ blankLine: 'any', prev: 'directive', next: 'directive' }, | ||
{ blankLine: 'always', prev: 'cjs-import', next: '*' }, | ||
{ blankLine: 'any', prev: 'cjs-import', next: 'cjs-import' }, | ||
{ blankLine: 'always', prev: '*', next: 'cjs-export' }, | ||
{ blankLine: 'any', prev: 'cjs-export', next: '*' }, | ||
{ blankLine: 'always', prev: 'multiline-block-like', next: '*' }, | ||
{ blankLine: 'always', prev: 'class', next: '*' }, | ||
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' }, | ||
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] }, | ||
{ blankLine: 'always', prev: ['case', 'default'], next: '*' }, | ||
], | ||
'prettier/prettier': 'error', | ||
}, | ||
}, | ||
}; | ||
js.configs.recommended, | ||
nodePlugin.configs['flat/recommended'], | ||
eslintPluginPrettierRecommended, | ||
{ | ||
rules: { | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
'no-console': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
'prettier/prettier': 'error', | ||
}, | ||
}, | ||
]; |
{ | ||
"name": "@madgex/eslint-config-madgex", | ||
"version": "1.4.1", | ||
"version": "2.0.0", | ||
"type": "commonjs", | ||
"description": "Madgex ESLint config - based on eslint-config-airbnb", | ||
@@ -15,14 +16,14 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"eslint": "^7.20.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"eslint-plugin-promise": "^4.3.1", | ||
"prettier": "^2.2.1" | ||
"@eslint/js": ">=9", | ||
"eslint": ">=9", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-n": "^17.2.1", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"globals": ">=15", | ||
"prettier": ">=3" | ||
}, | ||
"engines": { | ||
"node": ">= 10" | ||
"node": ">=18" | ||
}, | ||
"gitHead": "ad06b58dfdd49fb6d66ac53fe0d8b58e63d8e871" | ||
"gitHead": "2bbdb8be7d056e210ce28579c116e05d2f9362c8" | ||
} |
@@ -8,13 +8,42 @@ # eslint-config-madgex | ||
```bash | ||
npm install @madgex/eslint-config-madgex -save-dev | ||
npm install eslint@9 @madgex/eslint-config-madgex -save-dev | ||
``` | ||
## VSCode extension | ||
Use VSCode Extension v3.0.5+ (you might need to switch to pre-release version) | ||
## Usage | ||
Extend `@madgex/eslint-config-madgex` in your [.eslintrc.json](https://eslint.org/docs/user-guide/configuring): | ||
> ⚠️ 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. | ||
```json | ||
// package.json | ||
// ESM import/export modules, set to commonjs if you are using `require/module.exports`, you cant use both | ||
"type": "module", | ||
{ | ||
"extends": "@madgex/eslint-config-madgex" | ||
"engines": { | ||
"node": ">=18" | ||
} | ||
} | ||
``` | ||
### Node/Browser | ||
```js | ||
// eslint.config.js | ||
import configMadgex from '@madgex/eslint-config-madgex'; | ||
export default [...configMadgex]; | ||
``` | ||
### Vue | ||
config order matters. | ||
```js | ||
// eslint.config.js | ||
import configMadgex from '@madgex/eslint-config-madgex'; | ||
import pluginVue from 'eslint-plugin-vue'; | ||
export default [...configMadgex, ...pluginVue.configs['flat/recommended']]; | ||
``` |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
49
4582
24
3
1