Skip to content

Instantly share code, notes, and snippets.

@ChrisMBarr
Last active December 26, 2017 02:27
Show Gist options
  • Save ChrisMBarr/937a7324cca3ee2f6bfed4ae553afe8f to your computer and use it in GitHub Desktop.
Save ChrisMBarr/937a7324cca3ee2f6bfed4ae553afe8f to your computer and use it in GitHub Desktop.
Configuration for TSLint's "ban" rule for modern Angular applications
"ban": [
true,
[ "angular", "each", "Don't rely on angular to perform loops. Either use a 'for of' loop or the native 'array.forEach': https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_each" ],
[ "jQuery", "each", "Don't rely on jQuery to perform loops. Either use a 'for of' loop or the native 'array.forEach': https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_each" ],
[ "$", "each", "Don't rely on jQuery to perform loops. Either use a 'for of' loop or the native 'array.forEach': https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_each" ],
[ "_", "each", "Don't rely on Underscore to perform loops. Either use a 'for of' loop or the native 'array.forEach': https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_each" ],
[ "_", "forEach", "Don't rely on Underscore to perform loops. Either use a 'for of' loop or the native 'array.forEach': https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_each" ],
[ "$", "ajax", "Don't rely on jQuery to make AJAX calls. $inject the Angular '$http' service instead" ],
[ "jQuery", "ajax", "Don't rely on jQuery to make AJAX calls. $inject the Angular '$http' service instead" ],
[ "$", "get", "Don't rely on jQuery to make AJAX calls. $inject the Angular '$http' service instead" ],
[ "jQuery", "get", "Don't rely on jQuery to make AJAX calls. $inject the Angular '$http' service instead" ],
[ "$", "getJSON", "Don't rely on jQuery to make AJAX calls. $inject the Angular '$http' service instead" ],
[ "jQuery", "getJSON", "Don't rely on jQuery to make AJAX calls. $inject the Angular '$http' service instead" ],
[ "$", "post", "Don't rely on jQuery to make AJAX calls. $inject the Angular '$http' service instead" ],
[ "jQuery", "post", "Don't rely on jQuery to make AJAX calls. $inject the Angular '$http' service instead" ],
[ "jQuery", "extend", "Don't rely on jQuery to extend an object, use 'angular.merge', 'angular.extend', or 'angular.copy' instead: http://davidcai.github.io/blog/posts/copy-vs-extend-vs-merge" ],
[ "$", "extend", "Don't rely on jQuery to extend an object, use 'angular.merge', 'angular.extend', or 'angular.copy' instead: http://davidcai.github.io/blog/posts/copy-vs-extend-vs-merge" ],
[ "_", "extend", "Don't rely on Underscore to extend an object, use 'angular.merge', 'angular.extend', or 'angular.copy' instead: http://davidcai.github.io/blog/posts/copy-vs-extend-vs-merge" ],
[ "_", "clone", "Don't rely on Underscore to shallow copy an object, either use 'angular.extend' to shallow copy, or 'angular.copy' to deep copy: http://davidcai.github.io/blog/posts/copy-vs-extend-vs-merge" ],
[ "_", "indexOf", "Use the native 'array.indexOf' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_indexof" ],
[ "_", "lastIndexOf", "Use the native 'array.lastIndexOf' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_lastindexof" ],
[ "_", "every", "Use the native 'array.every' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_every" ],
[ "_", "all", "Use the native 'array.every' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_every" ],
[ "_", "filter", "Use the native 'array.filter' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_filter" ],
[ "_", "select", "Use the native 'array.filter' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_filter" ],
[ "_", "includes", "Use the native 'array.indexOf' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_includes" ],
[ "_", "contains", "Use the native 'array.indexOf' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_includes" ],
[ "_", "map", "Use the native 'array.map' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_map" ],
[ "_", "collect", "Use the native 'array.map' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_map" ],
[ "_", "reduce", "Use the native 'array.reduce' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_reduce" ],
[ "_", "inject", "Use the native 'array.reduce' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_reduce" ],
[ "_", "foldl", "Use the native 'array.reduce' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_reduce" ],
[ "_", "reduceRight", "Use the native 'array.reduceRight' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_reduceright" ],
[ "_", "foldr", "Use the native 'array.reduceRight' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_reduceright" ],
[ "_", "some", "Use the native 'array.some' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_some" ],
[ "_", "any", "Use the native 'array.some' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_some" ],
[ "_", "isNaN", "Use the native 'isNaN' function instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_isnan" ],
[ "_", "keys", "Use the native 'Object.keys(myObj)' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_keys" ],
[ "_", "size", "Use the native 'array.length' or 'Object.keys(myObj).length' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_size" ],
[ "_", "values", "Use 'Object.keys(obj).map(key => obj[key])' instead of using the Underscore library" ],
[ "_", "pluck", "Use the native 'array.map(x => x.prop)' instead of using the Underscore library: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_pluck" ],
[ "_", "isNull", "Use the native 'someVar == null', or even simpler 'if(!someVar)', instead of using the Underscore library" ],
[ "_", "isUndefined", "Use the native 'someVar == undefined', or even simpler 'if(!someVar)', instead of using the Underscore library" ],
[ "_", "reverse", "Use the native 'array.reverse' instead of using the Underscore library - https://github.com/cht8687/You-Dont-Need-Lodash-Underscore#_reverse" ],
[ "_", "join", "Use the native 'array.join' instead of using the Underscore library - https://github.com/cht8687/You-Dont-Need-Lodash-Underscore#_join" ],
[ "_", "toUpper", "Use the native 'string.toUpperCase()' instead of using the Underscore library - https://github.com/cht8687/You-Dont-Need-Lodash-Underscore#_reverse" ],
[ "_", "toLower", "Use the native 'string.toLowerCase()' instead of using the Underscore library - https://github.com/cht8687/You-Dont-Need-Lodash-Underscore#_tolower" ],
[ "_", "trim", "Use the native 'string.trim()' instead of using the Underscore library - https://github.com/cht8687/You-Dont-Need-Lodash-Underscore#_trim" ],
[ "_", "after", "This can be done natively without using the Underscore library - https://github.com/cht8687/You-Dont-Need-Lodash-Underscore#_after" ]
],
@ChrisMBarr
Copy link
Author

ChrisMBarr commented Sep 19, 2016

TSLint: https://github.com/palantir/tslint

Use this to help reduce the reliance on 3rd party libraries where native JS code could be used instead. Most of this comes from this great article/repo that explains each one: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore

Also, this is a good resource: https://www.reindex.io/blog/you-might-not-need-underscore/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment