|
9 | 9 | // Requirements |
10 | 10 | //------------------------------------------------------------------------------ |
11 | 11 |
|
12 | | -const path = require("path"); |
13 | 12 | const rule = require("../../../lib/rules/no-redeclare"); |
14 | 13 | const { RuleTester } = require("../../../lib/rule-tester"); |
15 | 14 |
|
16 | 15 | //------------------------------------------------------------------------------ |
17 | 16 | // Tests |
18 | 17 | //------------------------------------------------------------------------------ |
19 | 18 |
|
20 | | -const looseParserPath = path.resolve(__dirname, "../../tools/loose-parser.js"); |
21 | 19 | const ruleTester = new RuleTester(); |
22 | 20 |
|
23 | 21 | ruleTester.run("no-redeclare", rule, { |
@@ -205,112 +203,6 @@ ruleTester.run("no-redeclare", rule, { |
205 | 203 | ] |
206 | 204 | }, |
207 | 205 |
|
208 | | - // let/const |
209 | | - { |
210 | | - code: "let a; let a;", |
211 | | - parser: looseParserPath, |
212 | | - parserOptions: { ecmaVersion: 2015 }, |
213 | | - errors: [ |
214 | | - { message: "'a' is already defined.", type: "Identifier" } |
215 | | - ] |
216 | | - }, |
217 | | - { |
218 | | - code: "let a; let a;", |
219 | | - parser: looseParserPath, |
220 | | - parserOptions: { ecmaVersion: 2015, sourceType: "module" }, |
221 | | - errors: [ |
222 | | - { message: "'a' is already defined.", type: "Identifier" } |
223 | | - ] |
224 | | - }, |
225 | | - { |
226 | | - code: "let a; let a;", |
227 | | - parser: looseParserPath, |
228 | | - parserOptions: { ecmaVersion: 2015, ecmaFeatures: { globalReturn: true } }, |
229 | | - errors: [ |
230 | | - { message: "'a' is already defined.", type: "Identifier" } |
231 | | - ] |
232 | | - }, |
233 | | - { |
234 | | - code: "let a; const a = 0;", |
235 | | - parser: looseParserPath, |
236 | | - parserOptions: { ecmaVersion: 2015 }, |
237 | | - errors: [ |
238 | | - { message: "'a' is already defined.", type: "Identifier" } |
239 | | - ] |
240 | | - }, |
241 | | - { |
242 | | - code: "const a = 0; const a = 0;", |
243 | | - parser: looseParserPath, |
244 | | - parserOptions: { ecmaVersion: 2015 }, |
245 | | - errors: [ |
246 | | - { message: "'a' is already defined.", type: "Identifier" } |
247 | | - ] |
248 | | - }, |
249 | | - { |
250 | | - code: "if (test) { let a; let a; }", |
251 | | - parser: looseParserPath, |
252 | | - parserOptions: { ecmaVersion: 2015 }, |
253 | | - errors: [ |
254 | | - { message: "'a' is already defined.", type: "Identifier" } |
255 | | - ] |
256 | | - }, |
257 | | - { |
258 | | - code: "switch (test) { case 0: let a; let a; }", |
259 | | - parser: looseParserPath, |
260 | | - parserOptions: { ecmaVersion: 2015 }, |
261 | | - errors: [ |
262 | | - { message: "'a' is already defined.", type: "Identifier" } |
263 | | - ] |
264 | | - }, |
265 | | - { |
266 | | - code: "for (let a, a;;);", |
267 | | - parser: looseParserPath, |
268 | | - parserOptions: { ecmaVersion: 2015 }, |
269 | | - errors: [ |
270 | | - { message: "'a' is already defined.", type: "Identifier" } |
271 | | - ] |
272 | | - }, |
273 | | - { |
274 | | - code: "for (let [a, a] in xs);", |
275 | | - parser: looseParserPath, |
276 | | - parserOptions: { ecmaVersion: 2015 }, |
277 | | - errors: [ |
278 | | - { message: "'a' is already defined.", type: "Identifier" } |
279 | | - ] |
280 | | - }, |
281 | | - { |
282 | | - code: "for (let [a, a] of xs);", |
283 | | - parser: looseParserPath, |
284 | | - parserOptions: { ecmaVersion: 2015 }, |
285 | | - errors: [ |
286 | | - { message: "'a' is already defined.", type: "Identifier" } |
287 | | - ] |
288 | | - }, |
289 | | - { |
290 | | - code: "function f() { let a; let a; }", |
291 | | - parser: looseParserPath, |
292 | | - parserOptions: { ecmaVersion: 2015 }, |
293 | | - errors: [ |
294 | | - { message: "'a' is already defined.", type: "Identifier" } |
295 | | - ] |
296 | | - }, |
297 | | - { |
298 | | - code: "function f(a) { let a; }", |
299 | | - parser: looseParserPath, |
300 | | - parserOptions: { ecmaVersion: 2015 }, |
301 | | - errors: [ |
302 | | - { message: "'a' is already defined.", type: "Identifier" } |
303 | | - ] |
304 | | - }, |
305 | | - { |
306 | | - code: "function f() { if (test) { let a; let a; } }", |
307 | | - parser: looseParserPath, |
308 | | - parserOptions: { ecmaVersion: 2015 }, |
309 | | - errors: [ |
310 | | - { message: "'a' is already defined.", type: "Identifier" } |
311 | | - ] |
312 | | - }, |
313 | | - |
314 | 206 | // Comments and built-ins. |
315 | 207 | { |
316 | 208 | code: "/*globals Array */", |
|
0 commit comments