'eslint-plugin-only-warn return all rules as warning but still has an error in my application
I want to set all rules as warning because I don't want to edit all the code section. I tried to use prettier plugin, but it has a lot of dotted, then I prefer to use eslint-plugin-only-warn instead. All the rules are return as warning, but my application is still crashed. How to prevent error returned after all warning?
This is my terminal error log.
[nodemon] starting `npm start`
> [email protected] start
> eslint --max-warnings=0 src && npm run babel-node
D:\GitHub Works\SE Scholarship Website Project\database-backend\src\Database.js
24:7 warning 'RegisterError' is defined but never used no-unused-vars
135:14 warning 'result' is defined but never used no-unused-vars
153:15 warning 'filename' is assigned a value but never used no-unused-vars
176:10 warning 'result' is defined but never used no-unused-vars
186:13 warning 'filename' is assigned a value but never used no-unused-vars
198:10 warning 'result' is defined but never used no-unused-vars
215:155 warning 'result' is defined but never used no-unused-vars
225:13 warning 'filename' is assigned a value but never used no-unused-vars
D:\GitHub Works\SE Scholarship Website Project\database-backend\src\index.js
82:24 warning 'err' is defined but never used no-unused-vars
152:26 warning 'req' is defined but never used no-unused-vars
152:30 warning 'res' is defined but never used no-unused-vars
✖ 11 problems (0 errors, 11 warnings)
ESLint found too many warnings (maximum: 0).
[nodemon] app crashed - waiting for file changes before starting...
And my package.json settings.
{
"name": "database-backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"babel-node": "babel-node src/index.js",
"fix": "eslint src --fix",
"start": "eslint --max-warnings=0 src && npm run babel-node",
"dev": "nodemon --exec npm start"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.1",
"body-parser": "^1.19.2",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"email-validator": "^2.0.4",
"express": "^4.17.3",
"express-fileupload": "^1.3.1",
"express-session": "^1.17.2",
"express-validator": "^6.14.0",
"multer": "^1.4.4",
"mysql": "^2.18.1"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.8",
"@babel/eslint-parser": "^7.17.0",
"@babel/node": "^7.16.8",
"@babel/preset-env": "^7.16.11",
"eslint-plugin-only-warn": "^1.0.3",
"husky": "^7.0.4",
"nodemon": "^2.0.15"
},
"eslintConfig": {
"extends": [
"eslint:recommended"
],
"plugins": [
"only-warn"
],
"parser": "@babel/eslint-parser",
"env": {
"es6": true,
"browser": true
}
},
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
},
"browserslist": "> 0.25%, not dead"
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
