Skip to content

Feature/converter no default export 166 #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/rules/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { convertNoConstantCondition } from "./converters/no-constant-condition";
import { convertNoConstruct } from "./converters/no-construct";
import { convertNoControlRegex } from "./converters/no-control-regex";
import { convertNoDebugger } from "./converters/no-debugger";
import { convertNoDefaultExport } from "./converters/no-default-export";
import { convertNoDuplicateImports } from "./converters/no-duplicate-imports";
import { convertNoDuplicateSuper } from "./converters/no-duplicate-super";
import { convertNoDuplicateSwitchCase } from "./converters/no-duplicate-switch-case";
Expand Down Expand Up @@ -158,6 +159,7 @@ export const converters = new Map([
["no-construct", convertNoConstruct],
["no-control-regex", convertNoControlRegex],
["no-debugger", convertNoDebugger],
["no-default-export", convertNoDefaultExport],
["no-duplicate-imports", convertNoDuplicateImports],
["no-duplicate-super", convertNoDuplicateSuper],
["no-duplicate-switch-case", convertNoDuplicateSwitchCase],
Expand Down
12 changes: 12 additions & 0 deletions src/rules/converters/no-default-export.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { RuleConverter } from "../converter";

export const convertNoDefaultExport: RuleConverter = () => {
return {
rules: [
{
ruleName: "import/no-default-export",
},
],
plugins: ["import"],
};
};
18 changes: 18 additions & 0 deletions src/rules/converters/tests/no-default-export.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { convertNoDefaultExport } from "../no-default-export";

describe(convertNoDefaultExport, () => {
test("conversion without arguments", () => {
const result = convertNoDefaultExport({
ruleArguments: [],
});

expect(result).toEqual({
rules: [
{
ruleName: "import/no-default-export",
},
],
plugins: ["import"],
});
});
});
1 change: 1 addition & 0 deletions test/tests/standalone tslint.json/eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
"@typescript-eslint/unbound-method": "off",
"arrow-body-style": "off",
"default-case": "off",
"import/no-default-export": "error",
"linebreak-style": "off",
"no-bitwise": "off",
"no-empty": "off",
Expand Down
5 changes: 3 additions & 2 deletions test/tests/standalone tslint.json/stdout.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
19 rules replaced with their ESLint equivalents. ✨
20 rules replaced with their ESLint equivalents. ✨
️👀 2 rules do not yet have ESLint equivalents; defaulting to eslint-plugin-tslint. 👀
1 package is required for new ESLint rules. ⚡
2 packages are required for new ESLint rules. ⚡
unicorn
import
✅ All is well! ✅
1 change: 1 addition & 0 deletions test/tests/standalone tslint.json/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"no-any": false,
"no-bitwise": false,
"no-empty": false,
"no-default-export": true,
"no-magic-numbers": false,
"no-import-side-effect": false,
"no-implicit-dependencies": [true, "dev"],
Expand Down