Skip to content

Instantly share code, notes, and snippets.

@Quramy
Created January 14, 2020 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Quramy/45e676128d99e30e22ce0235b6e53c96 to your computer and use it in GitHub Desktop.
Save Quramy/45e676128d99e30e22ce0235b6e53c96 to your computer and use it in GitHub Desktop.
import { Rule } from "eslint";
const rule: Rule.RuleModule = {
create: (context) => {
return {
['NewExpression:not(:has(*.arguments)) > Identifier[name="Date"], CallExpression > MemberExpression:has(Identifier.object[name="Date"]) > Identifier.property[name="now"]']: (node: any) => {
context.report({
message: "Don't use side-effective Date function.",
node,
});
},
};
}
};
export = rule;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment