arvitaly / tslint-plugin-graphql

Check your GraphQL query strings against a schema.
MIT License
17 stars 5 forks source link

tslint CLI - Error: Cannot find module 'tslint' #8

Open vjsingh opened 6 years ago

vjsingh commented 6 years ago

Bug Report

with tslint.json configuration:

{
  "extends": [
    "tslint:latest", 
    "tslint-react",
    "tslint-plugin-graphql"
  ],
  "rules": {
    "graphql": [
        true,
        {
            "env": "apollo",
            "schemaJsonFilepath": "./server/src/generated/generatedAppSchema.json",
            "tagName": "gql"
        }
    ]
  }
}

Actual behavior

I have tslint successfully set up in my Node+React project.

When I try to run tslint from the command line, I get the following error:

tslint -c tslint.json 'server/src/utils.ts' { Error: Cannot find module 'tslint' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15) at Function.Module._load (internal/modules/cjs/loader.js:520:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object. (/Users/Varun/Documents/workspace/clyme/node_modules/tslint-plugin-graphql/rules/graphqlRule.js:16:16) at Module._compile (internal/modules/cjs/loader.js:702:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10) at Module.load (internal/modules/cjs/loader.js:612:32) at tryModuleLoad (internal/modules/cjs/loader.js:551:12) at Function.Module._load (internal/modules/cjs/loader.js:543:3) code: 'MODULE_NOT_FOUND' }

If I remove the "GraphQL" rule from tslint.json, the tslint command runs

Expected behavior

tslint should run