airbnb / airbnb/javascript

ESLint + phantomjs not working

Open
#1,529 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
148k
Forks
26.6k
PR merge metrics
No merged PRs in 30d

Description

## Context
I am converting all of https://github.com/amir20/phantomjs-node to use AirBnB lint with prettier. I followed [this tutorial](https://hackernoon.com/configure-eslint-prettier-and-flow-in-vs-code-for-react-development-c9d95db07213) to configure eslint, flow and prettier.

## Problem
Everything seemed ok and I was going through some of the coding styles that `--fix` couldn't fix. A few looked like the below.

```
phantomjs-node/src/shim/index.js
3:1 error 'webpage' should be listed in the project's dependencies. Run 'npm i -S webpage' to add it import/no-extraneous-dependencies
3:21 error Unable to resolve path to module 'webpage' import/no-unresolved
3:21 error Missing file extension for "webpage" import/extensions
4:1 error 'system' should be listed in the project's dependencies. Run 'npm i -S system' to add it import/no-extraneous-dependencies
```

I did some research and couldn't find anything about this. I was under the assumption that `/* eslint-env phantomjs */` should fix this. I am a little stumped because it seems like AirBnB's base config for eslint doesn't work with phantomjs. Is this true?

Here is my `.eslintrc.json`

```json
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jest": true,
"phantomjs": true
},
"extends": "airbnb-base",
"parser": "babel-eslint",
"plugins": ["import"]
}
```

## Questions

1. How do I get phantomjs env globals and imports to work with AirBnB coding style?
2. This used to work with `"extends": "fbjs/strict"`. Was it disabled or removed?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the ESLint output for phantomjs-node/src/shim/index.js and compare it with the settings in .eslintrc.json, including the phantomjs environment and airbnb-base configuration. Determine why the reported globals and imports are unresolved, then verify that the intended PhantomJS code no longer produces those errors and clarify whether the previous fbjs/strict behavior is still supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.