Skip to content

Add support for @wordpress/eslint-plugin #436

@toddmilliken

Description

@toddmilliken

My codeclimate build in my repo is failing due to my latest changes to codeclimate's eslint config, which says

/usr/src/app/lib/validate_config.js:18
        throw e;
        ^

Error: Cannot find module '@wordpress/eslint-plugin'
Referenced from: /code/.eslintrc.json
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.resolve (internal/module.js:18:19)
    at resolve (/usr/local/node_modules/eslint/lib/config/config-file.js:475:31)
    at load (/usr/local/node_modules/eslint/lib/config/config-file.js:556:26)
    at configExtends.reduceRight (/usr/local/node_modules/eslint/lib/config/config-file.js:430:36)
    at Array.reduceRight (<anonymous>)
    at applyExtends (/usr/local/node_modules/eslint/lib/config/config-file.js:408:26)
    at loadFromDisk (/usr/local/node_modules/eslint/lib/config/config-file.js:528:22)
    at Object.load (/usr/local/node_modules/eslint/lib/config/config-file.js:564:20)
    at Config.getLocalConfigHierarchy (/usr/local/node_modules/eslint/lib/config.js:227:44)

So to fix this, I was going to try and add a PR here to add the @wordpress/eslint-plugin package to the available eslint plugins, as this seems to be the standard for Gutenberg development and I wanted to match the same configuration.

Actual Behavior

I branched off of channel/eslint-5 to attempt to add this package.

My first attempt, I ran:

bin/yarn add @wordpress/eslint-plugin

yielded the following:

yarn add v0.21.3
[1/4] Resolving packages...
[2/4] Fetching packages...
error eslint@5.8.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

In my second attempt, I ran the command again using the --ignore-engines flag to see if that would at least move it along:

bin/yarn add @wordpress/eslint-plugin --ignore-engines

Which yielded a much larger error message

yarn add v0.21.3
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "eslint-config-dbk@3.3.4" has incorrect peer dependency "eslint@^4.3.0".
warning "eslint-config-dbk@3.3.4" has unmet peer dependency "lint-staged@>= 6.0.0".
warning "eslint-config-hapi@12.0.0" has unmet peer dependency "eslint-plugin-hapi@4.x.x".
warning "eslint-config-react-app@3.0.5" has incorrect peer dependency "babel-eslint@9.x".
warning "eslint-config-react-app@3.0.5" has incorrect peer dependency "eslint-plugin-flowtype@2.x".
warning "eslint-config-signavio@3.2.0" has incorrect peer dependency "eslint@^3.19.0 || ^4.0.0".
warning "eslint-config-vue@2.0.2" has incorrect peer dependency "eslint@^2.0.0 || ^3.0.0".
warning "eslint-config-vue@2.0.2" has incorrect peer dependency "eslint-plugin-vue@^1.0.0 || ^2.0.0".
warning "eslint-plugin-vue@4.7.1" has incorrect peer dependency "eslint@^3.18.0 || ^4.0.0".
warning "eslint-plugin-xogroup@2.2.0" has incorrect peer dependency "eslint@4.x.x".
warning "eslint-config-airbnb@16.1.0" has incorrect peer dependency "eslint@^4.9.0".
warning "eslint-plugin-mocha@4.12.1" has incorrect peer dependency "eslint@^2.0.0 || ^3.0.0 || ^4.0.0".
warning "eslint-config-airbnb@15.1.0" has incorrect peer dependency "eslint@^3.19.0 || ^4.3.0".
warning "eslint-plugin-import@2.7.0" has incorrect peer dependency "eslint@2.x - 4.x".
warning "eslint-plugin-jsx-a11y@5.1.1" has incorrect peer dependency "eslint@^2.10.2 || ^3 || ^4".
warning "eslint-plugin-react@7.3.0" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0".
warning "eslint-config-airbnb-base@12.1.0" has incorrect peer dependency "eslint@^4.9.0".
warning "eslint-config-airbnb-base@11.3.2" has incorrect peer dependency "eslint@^3.19.0 || ^4.5.0".
warning "eslint-plugin-jsx-a11y@6.0.2" has incorrect peer dependency "eslint@^3 || ^4".
warning "eslint-plugin-react@7.7.0" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0".
[4/4] Building fresh packages...
error /usr/src/app/node_modules/phantomjs-prebuilt: Command failed.
Exit code: 1
Command: sh
Arguments: -c node install.js
Directory: /usr/src/app/node_modules/phantomjs-prebuilt
Output:
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...

Received 22866K total.
Extracting tar contents (via spawned process)
Error extracting archive
Phantom installation failed { Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)
  killed: false,
  code: 2,
  signal: null,
  cmd: 'tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2' } Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Expected Behavior

For the package to be installed in package.json and the yarn.lock file update

Steps to reproduce

  1. Clone the codeclimate-eslint repo.
  2. Checkout the channel/eslint-5 branch.
  3. Start a new branch off of that and name it test-@wordpress-eslint-plugin
  4. Run bin/yarn add @wordpress/eslint-plugin and note errors.
  5. Run bin/yarn add @wordpress/eslint-plugin --ignore-engines and note errors.

Relevant links


Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions