From 5cc58e06be5bc0135d9af99938b579724c20465d Mon Sep 17 00:00:00 2001 From: futpib Date: Fri, 15 Feb 2019 23:09:46 +0300 Subject: [PATCH] WIP: Add failing named import/export tests --- test/prevent-abbreviations.js | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/test/prevent-abbreviations.js b/test/prevent-abbreviations.js index 9f9b674685..1d1ae505b8 100644 --- a/test/prevent-abbreviations.js +++ b/test/prevent-abbreviations.js @@ -5,6 +5,9 @@ import rule from '../rules/prevent-abbreviations'; const ruleTester = avaRuleTester(test, { env: { es6: true + }, + parserOptions: { + sourceType: 'module' } }); @@ -117,7 +120,10 @@ ruleTester.run('prevent-abbreviations', rule, { function f() { return g.apply(this, arguments) + args; } - ` + `, + + // Renaming would change the API of the module + 'export const err = {};' ], invalid: [ @@ -355,6 +361,36 @@ ruleTester.run('prevent-abbreviations', rule, { }; `, errors: createErrors() + }, + + { + code: ` + import err from 'err'; + `, + output: ` + import error from 'err'; + `, + errors: createErrors() + }, + { + code: ` + import {err} from 'err'; + `, + output: ` + import {err as error} from 'err'; + `, + errors: createErrors() + }, + { + code: ` + let err; + export {err}; + `, + output: ` + let error; + export {error as err}; + `, + errors: createErrors() } ] });