I am using AWS lambda dependencies layer which is a child folder that includes (node_modules and .eslintrc.json).
Project structure:
.
├── dependencies
| └── nodejs
| ├── utils
| ├── services
| ├── node_modules
| ├── package.json
| └── .eslintrc.json
└── src
└── signup
| ├── signup.js
| └── midllewares
| └── signup-validation.js
└── login
├── login.js
└── midllewares
└── login-validation.js
My problem is that eslint rules don't work on javascript inside src directory, it only works inside nodejs directory.
How to apply the rules on all .eslintrc.json's parent folders.
The solution I tried is to do npm install in the project root and move .eslintrc.json there, but it's an ugly solution to have package.json twice
- .eslintrc.json content
{
"env": {
"commonjs": true,
"es2021": true,
"node": true
},
"extends": ["eslint:recommended"],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"semi": ["error", "never"],
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
"no-unused-vars": ["error"],
"no-var": ["error"],
"prefer-const": ["warn"],
"curly": ["error", "all"],
"max-len": ["error", { "code": 140 }],
"camelcase": ["error", { "properties": "always" }]
}
}