@@ -36,79 +36,6 @@ function prepareChecker(args?: Partial<CheckerArgs>): Checker {
3636}
3737
3838describe ( 'checkCSSModule' , ( ) => {
39- test ( 'do not report diagnostics for invalid name as js identifier when namedExports is false' , async ( ) => {
40- const iff = await createIFF ( {
41- 'a.module.css' : dedent `
42- .a-1 { color: red; }
43- @value b-1, b-2 as a-2 from './b.module.css';
44- ` ,
45- 'b.module.css' : dedent `
46- @value b-1: red;
47- @value b-2: red;
48- ` ,
49- } ) ;
50- const check = prepareChecker ( ) ;
51- const diagnostics = check ( readAndParseCSSModule ( iff . paths [ 'a.module.css' ] ) ! ) ;
52- expect ( formatDiagnostics ( diagnostics , iff . rootDir ) ) . toMatchInlineSnapshot ( `[]` ) ;
53- } ) ;
54- test ( 'report diagnostics for invalid name as js identifier when namedExports is true' , async ( ) => {
55- const iff = await createIFF ( {
56- 'a.module.css' : dedent `
57- .a-1 { color: red; }
58- @value b-1, b-2 as a-2 from './b.module.css';
59- ` ,
60- 'b.module.css' : dedent `
61- @value b-1: red;
62- @value b-2: red;
63- ` ,
64- } ) ;
65- const check = prepareChecker ( { config : fakeConfig ( { namedExports : true } ) } ) ;
66- const diagnostics = check ( readAndParseCSSModule ( iff . paths [ 'a.module.css' ] ) ! ) ;
67- expect ( formatDiagnostics ( diagnostics , iff . rootDir ) ) . toMatchInlineSnapshot ( `
68- [
69- {
70- "category": "error",
71- "fileName": "<rootDir>/a.module.css",
72- "length": 3,
73- "start": {
74- "column": 2,
75- "line": 1,
76- },
77- "text": "Token names must be valid JavaScript identifiers when \`cmkOptions.namedExports\` is set to \`true\`.",
78- },
79- {
80- "category": "error",
81- "fileName": "<rootDir>/a.module.css",
82- "length": 3,
83- "start": {
84- "column": 8,
85- "line": 2,
86- },
87- "text": "Token names must be valid JavaScript identifiers when \`cmkOptions.namedExports\` is set to \`true\`.",
88- },
89- {
90- "category": "error",
91- "fileName": "<rootDir>/a.module.css",
92- "length": 3,
93- "start": {
94- "column": 13,
95- "line": 2,
96- },
97- "text": "Token names must be valid JavaScript identifiers when \`cmkOptions.namedExports\` is set to \`true\`.",
98- },
99- {
100- "category": "error",
101- "fileName": "<rootDir>/a.module.css",
102- "length": 3,
103- "start": {
104- "column": 20,
105- "line": 2,
106- },
107- "text": "Token names must be valid JavaScript identifiers when \`cmkOptions.namedExports\` is set to \`true\`.",
108- },
109- ]
110- ` ) ;
111- } ) ;
11239 test ( 'report diagnostics for "__proto__" name' , async ( ) => {
11340 const iff = await createIFF ( {
11441 'a.module.css' : dedent `
@@ -205,7 +132,7 @@ describe('checkCSSModule', () => {
205132 ]
206133 ` ) ;
207134 } ) ;
208- test ( 'report diagnostics for backslash in name when namedExports is false ' , async ( ) => {
135+ test ( 'report diagnostics for backslash in name' , async ( ) => {
209136 // NOTE: The backslash is valid syntax in class selectors, but it is invalid syntax in `@value`.
210137 // Therefore, it is sufficient for diagnostics to be reported only for class selectors.
211138 const iff = await createIFF ( {
@@ -225,7 +152,7 @@ describe('checkCSSModule', () => {
225152 "column": 2,
226153 "line": 1,
227154 },
228- "text": "Backslash (\\) is not allowed in names when \`cmkOptions.namedExports\` is set to \`false\` .",
155+ "text": "Backslash (\\) is not allowed in names.",
229156 },
230157 ]
231158 ` ) ;
0 commit comments