Content-Length: 528536 | pFad | https://github.com/nayounsang/typescript-eslint/commit/e5394b29b407fdc3039a5a271411d599924a607d

09 test: add testcase · nayounsang/typescript-eslint@e5394b2 · GitHub
Skip to content

Commit e5394b2

Browse files
committed
test: add testcase
1 parent 4ad8a07 commit e5394b2

File tree

1 file changed

+116
-33
lines changed

1 file changed

+116
-33
lines changed

packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts

Lines changed: 116 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,122 @@ export {};
17341734
],
17351735
filename: 'foo.d.ts',
17361736
},
1737+
{
1738+
code: `
1739+
import * as Unused from 'foo';
1740+
import * as Used from 'bar';
1741+
export { Used };
1742+
`,
1743+
errors: [
1744+
{
1745+
column: 13,
1746+
data: {
1747+
action: 'defined',
1748+
additional: '',
1749+
varName: 'Unused',
1750+
},
1751+
line: 2,
1752+
messageId: 'unusedVar',
1753+
},
1754+
],
1755+
options: [{ enableAutofixRemoval: { imports: true } }],
1756+
output: `
1757+
import * as Used from 'bar';
1758+
export { Used };
1759+
`,
1760+
},
1761+
{
1762+
code: `
1763+
import Unused1 from 'foo';
1764+
import Unused2, { Used } from 'bar';
1765+
export { Used };
1766+
`,
1767+
errors: [
1768+
{
1769+
column: 8,
1770+
data: {
1771+
action: 'defined',
1772+
additional: '',
1773+
varName: 'Unused1',
1774+
},
1775+
line: 2,
1776+
messageId: 'unusedVar',
1777+
},
1778+
{
1779+
column: 8,
1780+
data: {
1781+
action: 'defined',
1782+
additional: '',
1783+
varName: 'Unused2',
1784+
},
1785+
line: 3,
1786+
messageId: 'unusedVar',
1787+
},
1788+
],
1789+
options: [{ enableAutofixRemoval: { imports: true } }],
1790+
output: `
1791+
import { Used } from 'bar';
1792+
export { Used };
1793+
`,
1794+
},
1795+
{
1796+
code: `
1797+
import { Unused1 } from 'foo';
1798+
import Used1, { Unused2 } from 'bar';
1799+
import { Used2, Unused3 } from 'baz';
1800+
import Used3, { Unused4, Used4 } from 'foobar';
1801+
export { Used1, Used2, Used3, Used4 };
1802+
`,
1803+
errors: [
1804+
{
1805+
column: 10,
1806+
data: {
1807+
action: 'defined',
1808+
additional: '',
1809+
varName: 'Unused1',
1810+
},
1811+
line: 2,
1812+
messageId: 'unusedVar',
1813+
},
1814+
{
1815+
column: 17,
1816+
data: {
1817+
action: 'defined',
1818+
additional: '',
1819+
varName: 'Unused2',
1820+
},
1821+
line: 3,
1822+
messageId: 'unusedVar',
1823+
},
1824+
{
1825+
column: 17,
1826+
data: {
1827+
action: 'defined',
1828+
additional: '',
1829+
varName: 'Unused3',
1830+
},
1831+
line: 4,
1832+
messageId: 'unusedVar',
1833+
},
1834+
{
1835+
column: 17,
1836+
data: {
1837+
action: 'defined',
1838+
additional: '',
1839+
varName: 'Unused4',
1840+
},
1841+
line: 5,
1842+
messageId: 'unusedVar',
1843+
},
1844+
],
1845+
options: [{ enableAutofixRemoval: { imports: true } }],
1846+
output: `
1847+
import Used1 from 'bar';
1848+
import { Used2 } from 'baz';
1849+
import Used3, { Used4 } from 'foobar';
1850+
export { Used1, Used2, Used3, Used4 };
1851+
`,
1852+
},
17371853
],
17381854

17391855
valid: [
@@ -2946,39 +3062,6 @@ declare module 'foo' {
29463062
{
29473063
code: `
29483064
export import Bar = Something.Bar;
2949-
const foo: 1234;
2950-
`,
2951-
filename: 'foo.d.ts',
2952-
},
2953-
{
2954-
code: `
2955-
declare module 'foo' {
2956-
export import Bar = Something.Bar;
2957-
const foo: 1234;
2958-
export const bar: string;
2959-
export namespace NS {
2960-
const baz: 1234;
2961-
}
2962-
}
2963-
`,
2964-
filename: 'foo.d.ts',
2965-
},
2966-
{
2967-
code: `
2968-
export namespace Foo {
2969-
export import Bar = Something.Bar;
2970-
const foo: 1234;
2971-
export const bar: string;
2972-
export namespace NS {
2973-
const baz: 1234;
2974-
}
2975-
}
2976-
`,
2977-
filename: 'foo.d.ts',
2978-
},
2979-
{
2980-
code: `
2981-
export import Bar = Something.Bar;
29823065
const foo: 1234;
29833066
export const bar: string;
29843067
export namespace NS {

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/nayounsang/typescript-eslint/commit/e5394b29b407fdc3039a5a271411d599924a607d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy