palantir / tslint-react

:orange_book: Lint rules related to React & JSX for TSLint.
Apache License 2.0
749 stars 76 forks source link

Incompatible with tslint 4.0.1? #36

Closed iamdanfox closed 8 years ago

iamdanfox commented 8 years ago

I upgraded tslint from 3.15.1 to 4.0.1 this morning and hit this error:

> my-project@0.1.0 lint:tslint /Users/dfox/my-project
> tslint -c tslint.json 'src/**/*.ts*'

module.js:457
    throw err;
    ^

Error: Cannot find module 'tslint/lib/lint'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/dfox/my-project/node_modules/tslint-react/rules/jsxAlignmentRule.js:23:12)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)

I've got tslint-react version 1.1.0 and a tslint.json containing:

{
  "extends": [
    "tslint:latest",
    "tslint-react"
  ],
  "rules": {
    "jsx-no-multiline-js": false,
    "jsx-no-string-ref": true,
    "jsx-self-close": true,
    "object-literal-sort-keys": false,
    "ordered-imports": false,
    "switch-default": false,
    "trailing-comma": [
      true,
      {
        "multiline": "never",
        "singleline": "never"
      }
    ]
  }
}

My guess is that the line import * as Lint from "tslint/lib/lint"; could actually be replaced by:

import * as Linter from "tslint";
iamdanfox commented 8 years ago

Just realised PR #35 already addresses this!

adidahiya commented 8 years ago

@iamdanfox just published v2.0. let me know if you run into any issues. https://github.com/palantir/tslint-react/releases/tag/2.0.0