File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
src/converters/lintConfigs/rules Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ import { convertNoConsole } from "./ruleConverters/no-console";
163
163
import { convertNoConstantCondition } from "./ruleConverters/no-constant-condition" ;
164
164
import { convertNoConstruct } from "./ruleConverters/no-construct" ;
165
165
import { convertNoControlRegex } from "./ruleConverters/no-control-regex" ;
166
+ import { convertNoCookies } from "./ruleConverters/no-cookies" ;
166
167
import { convertNoDebugger } from "./ruleConverters/no-debugger" ;
167
168
import { convertNoDefaultExport } from "./ruleConverters/no-default-export" ;
168
169
import { convertNoDeleteExpression } from "./ruleConverters/no-delete-expression" ;
@@ -347,6 +348,7 @@ export const ruleConverters = new Map([
347
348
[ "no-constant-condition" , convertNoConstantCondition ] ,
348
349
[ "no-construct" , convertNoConstruct ] ,
349
350
[ "no-control-regex" , convertNoControlRegex ] ,
351
+ [ "no-cookies" , convertNoCookies ] ,
350
352
[ "no-debugger" , convertNoDebugger ] ,
351
353
[ "no-default-export" , convertNoDefaultExport ] ,
352
354
[ "no-delete-expression" , convertNoDeleteExpression ] ,
Original file line number Diff line number Diff line change
1
+ import { RuleConverter } from "../ruleConverter" ;
2
+
3
+ export const convertNoCookies : RuleConverter = ( ) => {
4
+ return {
5
+ rules : [
6
+ {
7
+ ruleArguments : [
8
+ {
9
+ message : "Forbidden call to document.cookie" ,
10
+ selector : 'MemberExpression[object.name="document"][property.name="cookie"]' ,
11
+ }
12
+ ] ,
13
+ ruleName : "restricted-syntax" ,
14
+ } ,
15
+ ] ,
16
+ } ;
17
+ } ;
Original file line number Diff line number Diff line change
1
+ import { convertNoCookies } from "../no-cookies" ;
2
+
3
+ describe ( convertNoCookies , ( ) => {
4
+ test ( "conversion without arguments" , ( ) => {
5
+ const result = convertNoCookies ( {
6
+ ruleArguments : [ ] ,
7
+ } ) ;
8
+
9
+ expect ( result ) . toEqual ( {
10
+ rules : [
11
+ {
12
+ ruleArguments : [
13
+ {
14
+ message : "Forbidden call to document.cookie" ,
15
+ selector : 'MemberExpression[object.name="document"][property.name="cookie"]' ,
16
+ }
17
+ ] ,
18
+ ruleName : "restricted-syntax" ,
19
+ } ,
20
+ ] ,
21
+ } ) ;
22
+ } ) ;
23
+ } ) ;
You can’t perform that action at this time.
0 commit comments