This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add firecloud/no-for, deprecate better/no-fors fp/no-loops
- Loading branch information
1 parent
b10579a
commit 0b7b5c5
Showing
7 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// NOTE modification of https://github.com/jfmengels/eslint-plugin-fp/blob/8757d3c/rules/no-loops.js | ||
// to allow for for...in, for...of, while and do...while | ||
|
||
/* eslint eslint-comments/no-unlimited-disable: off */ | ||
/* eslint-disable */ | ||
|
||
const create = function (context) { | ||
function reportForLoop(node) { | ||
context.report({ | ||
node, | ||
message: 'Unallowed use of `for` loop' | ||
}); | ||
} | ||
|
||
function reportWhileLoop(node) { | ||
context.report({ | ||
node, | ||
message: 'Unallowed use of `while` loop. Use recursion instead' | ||
}); | ||
} | ||
|
||
return { | ||
ForStatement: reportForLoop | ||
// ForInStatement: reportForLoop, | ||
// ForOfStatement: reportForLoop, | ||
|
||
// WhileStatement: reportWhileLoop, | ||
// DoWhileStatement: reportWhileLoop | ||
}; | ||
}; | ||
|
||
module.exports = { | ||
create, | ||
meta: { | ||
docs: { | ||
// description: 'Forbid the use of loops.', | ||
description: 'Forbid the use of for loops.', | ||
recommended: 'error' | ||
} | ||
} | ||
}; |