Created
May 7, 2019 14:54
-
-
Save jkyoutsey/53a0ceaa0dfe21b21685ab091e09235a to your computer and use it in GitHub Desktop.
TypeScript Bazel Lint Rule Functions Must Return Value
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
// A list of well-known functions that the return value must be used. If unused | |
// then the function call is either a no-op (e.g. 'foo.trim()' foo is unchanged) | |
// or can be replaced by another (Array.map() should be replaced with a loop or | |
// Array.forEach() if the return value is unused). | |
const METHODS_TO_CHECK = new Set<string>([ | |
['Array', 'concat'], | |
['Array', 'filter'], | |
['Array', 'map'], | |
['Array', 'slice'], | |
['Function', 'bind'], | |
['Object', 'create'], | |
['string', 'concat'], | |
['string', 'normalize'], | |
['string', 'padStart'], | |
['string', 'padEnd'], | |
['string', 'repeat'], | |
['string', 'slice'], | |
['string', 'split'], | |
['string', 'substr'], | |
['string', 'substring'], | |
['string', 'toLocaleLowerCase'], | |
['string', 'toLocaleUpperCase'], | |
['string', 'toLowerCase'], | |
['string', 'toUpperCase'], | |
['string', 'trim'], | |
].map(list => list.join('#'))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment