agoda-tslint
v0.3.1
Published
A set of TSLint rules used on some Agoda projects.
Downloads
589
Readme
agoda-tslint
A set of TSLint rules used on some Agoda projects.
do-not-use
Prints out a warning, that this function / method should not be used, and should get refactored if possible
A list of banned functions or methods in the following format:
- marking functions as not cool:
- just the name of the function:
"functionName"
- the name of the function in an array with one element:
["functionName"]
- an object in the following format:
{"name": "functionName", "message": "optional explanation message"}
- just the name of the function:
- marking methods as not cool:
- an array with the object name, method name and optional message:
["functionName", "methodName", "optional message"]
- an object in the following format:
{"name": ["objectName", "methodName"], "message": "optional message"}
- you can also ban deeply nested methods:
{"name": ["foo", "bar", "baz"]}
bansfoo.bar.baz()
- the first element can contain a wildcard (
*
) that matches everything.{"name": ["*", "forEach"]}
bans[].forEach(...)
,$(...).forEach(...)
,arr.forEach(...)
, etc.
- you can also ban deeply nested methods:
- an array with the object name, method name and optional message:
Example:
[].forEach(e => doSomething()); // -> not allowed
Example usage:
"do-not-use": [
true,
{name: ["*", "forEach"], message: "Please refactor and use regular loops instead"},
],
root-relative-imports
Prevents traversing upwards in directory structure when importing files, forcing the use of root relative imports instead.
Example:
import { MyComponent } from './MyComponent'; // -> allowed
import { MyComponent } from './Child/MyComponent'; // -> allowed
import { MyComponent } from 'components/MyComponent'; // -> allowed
import { MyComponent } from '../components/MyComponent'; // -> not allowed
Example usage:
"root-relative-imports": true,