humanmade / humanmade/linter-bot
linter-bot fails to run if ESLint is disabled and custom ESLint config exists
- Dominant language
- JavaScript
- Stars
- 16
- Forks
- 2
- Avg merge
- 17d 47m
- Merged PRs (30d)
- 1
Description
When using the hm-linter if the repo also has custom ESLint configs or plugins the linter fails
Whilst I understand that hmlinter-bot does not support custom ESLint configurations as it does not perform an `npm install` if ESLint is disabled in the `hmlinter.yml` as per below then the linter-bot should not load the custom repo ESLint config file at all.
### Expected
Even though ESLint is disabled the custom repo config is loaded and causes the linter bot to fail to initiase correctly
### Expected
If ESLint is disabled in the `hmlinter.yml` file then the custom ESLint config in the repo should not be passed and should be ignored.
### Configs
Here's a project `hmlinter.yml` file:
```yml
# GLOBAL SETTINGS
# By default, the version is set to "latest". This can be set to any version
# >=0.4.2, but you MUST include the full version number.
version: latest
# PER-STANDARD SETTINGS
phpcs:
# Set to false to disable phpcs
enabled: true
# Set to "inherit" to use the global version, "latest" for the latest
# version, or a specific full version number.
version: inherit
eslint:
enabled: false
version: inherit
stylelint:
enabled: false
version: inherit
```
Here's the `.eslintrc.json` file
```json
{
"extends": [ "prettier", "plugin:react/recommended", "prettier/react" ],
"parser": "babel-eslint",
...
...
```
The resulting hmlinter check displays the following:
```
Failed to run hmlinter
Could not run: Error: Failed to load plugin prettier: Cannot find module 'eslint-plugin-prettier'
Require stack:
/tmp/hmlinter-standards/eslint-latest/node_modules/eslint/lib/config/plugins.js
/tmp/hmlinter-standards/eslint-latest/node_modules/eslint/lib/config.js
/tmp/hmlinter-standards/eslint-latest/node_modules/eslint/lib/cli-engine.js
/tmp/hmlinter-standards/eslint-latest/node_modules/eslint/lib/api.js
/var/task/src/linters/eslint/index.js
/var/task/src/linters/index.js
/var/task/src/run.js
/var/task/src/hooks.js
/var/task/src/index.js
/var/task/index.js
/var/runtime/UserFunction.js
/var/runtime/index.js
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with src/linters/eslint/index.js, identified in the failure stack, and trace how the ESLint configuration is loaded when eslint is disabled in hmlinter.yml. Reproduce the example with the custom .eslintrc.json, then verify that disabled ESLint does not load the repository config or fail during initialization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100