Comments (14)
@aserra54 you are missing plugin https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
or atleast
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error"
}
}
and you should move jsx
to ecmaFeatures
see https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#eslintrcjson
from typescript-eslint.
For me, this snippet still reports errors on 1.0.0-rc.3
:
import { ExecutionResult } from 'graphql/execution/execute';
import { UnknownObject } from '../ts-utils';
export type RigelDispatch = <DataType extends UnknownObject>(
action: Action<DataType>
) => Promise<ExecutionResult<DataType>>;
error 'UnknownObject' is defined but never used typescript/no-unused-vars
from typescript-eslint.
Tested with the new @typescript-eslint
packages. All of them are fixed except one -- when referencing an imported namespace. For example, i18next
here.
import i18next from 'i18next';
export interface Translator extends i18next.i18n {}
Seems to trigger on both rules.
/Users/Miles/Sites/boost/packages/core/src/types.ts
8:8 warning 'debug' is defined but never used no-unused-vars
8:8 error 'debug' is defined but never used @typescript-eslint/no-unused-vars
9:8 warning 'i18next' is defined but never used no-unused-vars
9:8 error 'i18next' is defined but never used @typescript-eslint/no-unused-vars
from typescript-eslint.
You have to install and use eslint plugin React
from typescript-eslint.
Hi @milesj, could you please try upgrading to 1.0.0-rc.3
and see if that works for these cases?
Also just a tip, when linking to files in your repo, instead of linking to master, link to a commit. The commit link's content won't change, but the link to master will change when you push.
from typescript-eslint.
(you can hit y
to switch to a permalink for the current file)
from typescript-eslint.
I'll try the 1.0.0 version. typescript-eslint-parser
has also been updated/deprecate, so I'll try that also.
from typescript-eslint.
Trying 1.0.0-rc3 and parser 22.0.0. It crashes on 2 repos with the following error:
TypeError: Cannot read property 'length' of undefined
at TSInterfaceDeclaration (/Users/Miles/Sites/boost/node_modules/eslint-plugin-typescript/lib/rules/no-empty-interface.js:33:48)
at listeners.(anonymous function).forEach.listener (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/safe-emitter.js:45:58)
at Array.forEach (<anonymous>)
at Object.emit (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/node-event-generator.js:251:26)
at NodeEventGenerator.applySelectors (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/node-event-generator.js:280:22)
at NodeEventGenerator.enterNode (/Users/Miles/Sites/boost/node_modules/eslint/lib/util/node-event-generator.js:294:14)
at CodePathAnalyzer.enterNode (/Users/Miles/Sites/boost/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)
at nodeQueue.forEach.traversalInfo (/Users/Miles/Sites/boost/node_modules/eslint/lib/linter.js:750:28)
at Array.forEach (<anonymous>)
The line in no-empty-interfaces
is the following, which is different than this repo. Seems like an AST/tree mismatch.
const heritage = node.heritage.length;
if (node.body.body.length === 0 && heritage < 2) {
Also noticed that the eslint-plugin-typescript
has typescript-eslint-parser
as a dependency, which it probably shouldn't? Or at minimum should be a peer. It also has a peer dependency on ~3.1.1
, which will be annoying to maintain/consume, ^3.1.0
is much easier.
from typescript-eslint.
This is expected, there was a lot of changes in parser, and its not compatible with plugin, you have to wait for new release
from typescript-eslint.
Please read #73
from typescript-eslint.
Yup, assumed that was the problem. Will report back in a week.
from typescript-eslint.
Not sure if I should piggy-back off of this issue, but another false negative I'm seeing is in interface declarations, e.g.
import { Foo, Bar } from 'qux';
export class Baz implements Foo {
public bar: Bar;
}
Both Foo
and Bar
get tagged as being unused. Sample here:
https://github.com/aserra54/typescript-eslint-parser-no-unused-vars
from typescript-eslint.
I'm getting false positives on React components.
// react.tsx
import * as React from 'react';
import { Heading2 } from 'some-place';
export const Comp: React.FunctionComponent = () => (
<Heading2>Some content</Heading2>
);
/Users/simen/repos/monorepo/react.tsx
2:10 warning 'Heading2' is defined but never used @typescript-eslint/no-unused-vars
✖ 1 problem (0 errors, 1 warning)
config:
{
"extends": ["plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint"]
}
(this creates a couple of more errors for rules I've turned off)
from typescript-eslint.
Ah! Fair enough 🙂 I've forgotten all about that plugin, gonna be awesome to be able to use it again 😅
from typescript-eslint.
Related Issues (20)
- Bug: <short description of the issue> HOT 3
- Enhancement(rule-tester): Stricter rule test validations
- Enhancement(rule-tester): FlatRuleTester -> RuleTester
- Enhancement(rule-tester): detect duplicate test cases
- Enhancement(rule-tester): check for parsing errors in suggestion fixes
- Enhancement(rule-tester): check for missing placeholder data in the message
- Docs: Add blog post announcing v8 beta
- Docs: Consider using a URL shortener for links printed by code HOT 3
- Repo: Add a CI check that 'breaking change' PR descriptions start with the right title text
- Repo: Raise TSConfig lib/target support range to match ESLint's
- Enhancement: [return-await] Option for unopinionated "in-try-catch" HOT 4
- Bug: "Too many files (>8) have matched the default project" error triggers on every file after 8 HOT 2
- Docs: `method-signature-style` lint rule ❤ `--enforceReadonly` compiler flag
- Rule proposal: Disallow calling Number.isNaN on non-number types HOT 10
- Configs: Make consistent-type-imports 'error' for the recommended config HOT 10
- Enhancement: [consistent-type-imports] option to only enable for internal dependencies HOT 3
- Bug: no-undef a error analysis HOT 1
- Bug: [no-unncessary-condition] Incorrectly detects possible values of type around await HOT 6
- Bug: [use-unknown-in-catch-callback-variable] Does not flag second argument of `.then` HOT 1
- Enhancement: [use-unknown-in-catch-callback-variable] Option to only check inline functions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript-eslint.