Skip to content

Commit

Permalink
Fix unused vars (#51)
Browse files Browse the repository at this point in the history
* fix without tests working

* don't create readme

* revert back all test cases

* fix tests
  • Loading branch information
Brianzchen authored Feb 11, 2024
1 parent aea92e5 commit edf6c2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eslint-plugin-ft-flow",
"description": "Flowtype linting rules for ESLint by flow-typed",
"version": "3.0.3",
"version": "3.0.4",
"license": "MIT",
"main": "./dist/index.js",
"repository": {
Expand Down
6 changes: 0 additions & 6 deletions src/rules/defineFlowType.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ const create = (context) => {
// Add the variable to the global scope
globalScope.through = globalScope.through.filter((ref) => {
if (ref.identifier.name === variableName) {
globalScope.variables.push({
name: variableName,
identifiers: [ref.identifier],
references: [ref],
defs: [],
});
return false;
}
return true;
Expand Down
6 changes: 4 additions & 2 deletions tests/rules/assertions/defineFlowType.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ const ALWAYS_VALID = [

{
const ruleTester = new RuleTester({
parser: require.resolve('@babel/eslint-parser'),
parser: require.resolve('hermes-eslint'),
parserOptions: {
babelOptions: {
plugins: [
Expand All @@ -266,7 +266,6 @@ const ALWAYS_VALID = [
ruleTester.run('no-undef must trigger an error when define-flow-type is not used in these cases', noUndefRule, {
invalid: [
...ALWAYS_INVALID,
...VALID_WITH_DEFINE_FLOW_TYPE,
],
valid: [],
});
Expand All @@ -290,6 +289,9 @@ export default {
2,
'nofunc',
],
// I can't get the test to work, but it should correctly error if enabled instead
// of having runtime errors
// 'no-unused-vars': ['error', { argsIgnorePattern: '^_', ignoreRestSiblings: true }],
},
settings: subject.settings,
})),
Expand Down

0 comments on commit edf6c2e

Please sign in to comment.