Skip to content

Instantly share code, notes, and snippets.

@getify getify/1.md
Created Mar 2, 2019

Embed
What would you like to do?
problem making eslint plugin work... help!?
$> node_modules/eslint/bin/eslint.js --version
v5.15.0

$> cat foo.js
"use strict";
var x = y => foo(y);

$> cat .eslintrc.json
{
  "env": {
    "es6": true
  },
  "parserOptions": {
    "ecmaVersion": 2018
  },
  "rules": {
    "foobar": "error"
  }
}

$> cat node_modules/eslint-plugin-foobar/package.json
{
  "name": "eslint-plugin-foobar",
  "version": "1.0.0",
  "description": "testing fake eslint rule",
  "main": "./lib/index.js",
  "dependencies": {},
}

$> cat node_modules/eslint-plugin-foobar/lib/index.js
"use strict";

module.exports = {
  create(context) {
    return {
      Identifier: function enter(node) {}
    };
  }
};

$> node_modules/eslint/bin/eslint.js --plugin='foobar' --rule='foobar: error' --debug foo.js
  eslint:cli CLI args: [ '--plugin=foobar', '--rule=foobar: error', '--debug', 'foo.js' ] +0ms
  eslint:cli Running on files +7ms
  eslint:glob-utils Creating list of files to process. +0ms
  eslint:ignored-paths baseDir = "/private/tmp" +0ms
  eslint:ignored-paths addPatternRelativeToCwd:
  eslint:ignored-paths   original = "/node_modules/*"
  eslint:ignored-paths   cooked   = "/node_modules/*" +1ms
  eslint:ignored-paths addPatternRelativeToCwd:
  eslint:ignored-paths   original = "/bower_components/*"
  eslint:ignored-paths   cooked   = "/bower_components/*" +0ms
  eslint:ignored-paths addPatternRelativeToCwd:
  eslint:ignored-paths   original = ".*"
  eslint:ignored-paths   cooked   = ".*" +0ms
  eslint:ignored-paths addPatternRelativeToCwd:
  eslint:ignored-paths   original = "!../"
  eslint:ignored-paths   cooked   = "!../" +1ms
  eslint:ignored-paths Looking for ignore file in /private/tmp +0ms
  eslint:ignored-paths Could not find ignore file in cwd +0ms
  eslint:ignored-paths contains: +1ms
  eslint:ignored-paths   target = "/private/tmp/foo.js" +0ms
  eslint:ignored-paths   result = false +0ms
  eslint:ignored-paths contains: +0ms
  eslint:ignored-paths   target = "/private/tmp/foo.js" +1ms
  eslint:ignored-paths   result = false +0ms
  eslint:cli-engine Processing /private/tmp/foo.js +0ms
  eslint:cli-engine Linting /private/tmp/foo.js +1ms
  eslint:config Constructing config file hierarchy for /private/tmp +0ms
  eslint:config Using .eslintrc and package.json files +0ms
  eslint:config Loading /private/tmp/.eslintrc.json +2ms
  eslint:config-file Loading JSON config file: /private/tmp/.eslintrc.json +0ms
  eslint:config Using /private/tmp/.eslintrc.json +13ms
  eslint:config-ops Using config from partial cache +0ms
  eslint:plugins Loaded plugin foobar (eslint-plugin-foobar@1.0.0) (from /private/tmp/node_modules/eslint-plugin-foobar/lib/index.js) +0ms
  eslint:config-ops Apply environment settings to config +3ms
  eslint:config-ops Creating config for environment browser +0ms
  eslint:config-ops Creating config for environment commonjs +1ms
  eslint:config-ops Creating config for environment es6 +0ms
  eslint:config-ops Creating config for environment node +0ms
  eslint:linter Linting code for /private/tmp/foo.js (pass 1) +0ms
  eslint:linter Generating fixed text for /private/tmp/foo.js (pass 1) +25ms
  eslint:source-code-fixer Applying fixes +0ms
  eslint:source-code-fixer shouldFix parameter was false, not attempting fixes +0ms
  eslint:cli-engine Linting complete in: 53ms +46ms

/private/tmp/foo.js
  1:1  error  Definition for rule 'foobar' was not found  foobar

✖ 1 problem (1 error, 0 warnings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.