routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
import {GlobalReferenceTracker} from './utils/global-reference-tracker.js';
|
||||
|
||||
const MESSAGE_ID = 'no-document-cookie';
|
||||
const messages = {
|
||||
[MESSAGE_ID]: 'Do not use `document.cookie` directly.',
|
||||
};
|
||||
|
||||
const tracker = new GlobalReferenceTracker({
|
||||
object: 'document.cookie',
|
||||
filter: ({node}) => node.parent.type === 'AssignmentExpression' && node.parent.left === node,
|
||||
handle: ({node}) => ({node, messageId: MESSAGE_ID}),
|
||||
});
|
||||
|
||||
/** @type {import('eslint').Rule.RuleModule} */
|
||||
const config = {
|
||||
create(context) {
|
||||
tracker.listen({context});
|
||||
},
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Do not use `document.cookie` directly.',
|
||||
recommended: 'unopinionated',
|
||||
},
|
||||
messages,
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user