Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin doesn't check .ts and .tsx files out of box? #355

Closed
wszymanski opened this issue Mar 15, 2019 · 5 comments
Closed

Plugin doesn't check .ts and .tsx files out of box? #355

wszymanski opened this issue Mar 15, 2019 · 5 comments
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin wontfix This will not be worked on

Comments

@wszymanski
Copy link

wszymanski commented Mar 15, 2019

My ESLint configured for project with @typescript-eslint/eslint-plugin (installed as devDependency), enabled in plugin section doesn't check my .ts and .tsx project files, but works on .js files.

Maybe I should use --ext .js,.ts,.tsx in the lint script? Is not plugin also for this?

ESLint config file

module.exports = {
  "extends": ["airbnb"],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "project": "./tsconfig.json"
  },
  "plugins": ["@typescript-eslint"],
  "rules": {
    "no-multiple-empty-lines": ["error", {
      "max": 1
    }],
    "quotes": ["error", "double"],
    "eol-last": ["error", "never"],
    "max-len": ["error", 120]
  }
};

Part of package.json file.

"scripts": 
  "build": "webpack",
  "watch": "webpack-dev-server --mode development",
  "lint": "eslint ./"
},

Please take a look at the below screenshot. We can see just error for test2.js file, but not for the same test2.ts file (event my IDE doesn't "highlight" error, but I suppose it may be their problem).

Screenshot 2019-03-15 at 13 36 43

Expected Result

Listed errors also for test1.ts file.

Actual Result

No errors for test1.ts file.

Versions

package version
@typescript-eslint/eslint-plugin 1.4.2
@typescript-eslint/parser 1.4.2
TypeScript 3.3.3333
ESLint 5.3.0
eslint-config-airbnb 17.1.0
eslint-plugin-import 2.16.0
eslint-plugin-jsx-a11y 6.2.1
eslint-plugin-react 7.12.4
node 10.5.0
npm 6.8.0
@wszymanski wszymanski added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Mar 15, 2019
@ldrick
Copy link
Contributor

ldrick commented Mar 15, 2019

Hi, specifying extension is currently not possible in configs, see eslint/eslint#10828
But with this great RFC eslint/rfcs#9 it would be possible.

For the time being, you need to specify extensions with --ext, like you already mentioned.

@wszymanski
Copy link
Author

Thank you!

@bradzacher bradzacher added wontfix This will not be worked on and removed triage Waiting for maintainers to take a look labels Mar 15, 2019
@bradzacher
Copy link
Member

As @ldrick said, this is a limitation of eslint.
By default it only checks .js and .jsx files.
Currently the only way to enable checking of other extensions is via the --ext CLI arg.

Our parser essentially only does one thing - adds support for parsing files which include typescript language features.
However unfortunately it can only parse the files that eslint passes to it.

@faisalil
Copy link

faisalil commented Dec 5, 2019

What about the browser extension, is there a way to have it enabled and show error on ts/tsx files?

@bradzacher
Copy link
Member

We only parse and lint the files that we are given by eslint.
You have to check with the maintainer of whatever tool you're using.

@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants