diff --git a/packages/codemods/Feature Flags/remove-unused-feature-flags/.codemodrc.json b/packages/codemods/Feature Flags/remove-unused-feature-flags/.codemodrc.json
deleted file mode 100644
index 30d6d8fb1..000000000
--- a/packages/codemods/Feature Flags/remove-unused-feature-flags/.codemodrc.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.0",
- "private": false,
- "name": "remove-unused-feature-flags",
- "engine": "jscodeshift",
- "arguments": [
- {
- "name": "functionName",
- "kind": "string",
- "default": "isFlagEnabled"
- },
- {
- "name": "featureFlagName",
- "kind": "string",
- "default": "featureFlag",
- "required": true
- }
- ],
- "meta": {
- "tags": ["migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/Feature Flags/remove-unused-feature-flags"
- }
-}
diff --git a/packages/codemods/Feature Flags/remove-unused-feature-flags/README.md b/packages/codemods/Feature Flags/remove-unused-feature-flags/README.md
deleted file mode 100644
index 7c0f2922c..000000000
--- a/packages/codemods/Feature Flags/remove-unused-feature-flags/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-This experimental codemod replaces function calls in a for of `await functionName(featureFlagName)`, where:
-
-- `functionName` is the target function name (default: `isFlagEnabled`),
-- `featureFlagName` is the target feature flag name.
-
-You need to pass these arguments using the Codemod Arguments' settings or using the Codemod CLI.
-
-## Example
-
-### Before:
-
-```tsx
-const [a, b] = await Promise.all([
- Promise.resolve('a'),
- isFlagEnabled('featureFlag'),
-]);
-
-const x = b && c;
-
-const y = ;
-```
-
-### After:
-
-```tsx
-const a = await Promise.resolve('a');
-
-const x = c;
-
-const y = ;
-```
\ No newline at end of file
diff --git a/packages/codemods/Feature Flags/remove-unused-feature-flags/package.json b/packages/codemods/Feature Flags/remove-unused-feature-flags/package.json
deleted file mode 100644
index 236118fd1..000000000
--- a/packages/codemods/Feature Flags/remove-unused-feature-flags/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-feature-flags-remove-unused-feature-flags",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/Feature Flags/remove-unused-feature-flags/src/index.ts b/packages/codemods/Feature Flags/remove-unused-feature-flags/src/index.ts
deleted file mode 100644
index c5839c65f..000000000
--- a/packages/codemods/Feature Flags/remove-unused-feature-flags/src/index.ts
+++ /dev/null
@@ -1,214 +0,0 @@
-import type { API, FileInfo, Options } from "jscodeshift";
-
-export default function transform(
- file: FileInfo,
- api: API,
- options: Options,
-): string | undefined {
- const functionName = String(options.functionName ?? "isFlagEnabled");
- const featureFlagName = String(options.featureFlagName ?? "featureFlag");
-
- let dirtyFlag = false;
-
- const j = api.jscodeshift;
- const root = j(file.source);
-
- root
- .find(j.CallExpression, {
- type: "CallExpression",
- callee: {
- type: "Identifier",
- name: functionName,
- },
- arguments: [
- {
- type: "StringLiteral" as const,
- value: featureFlagName,
- },
- ],
- })
- .replaceWith(() => {
- dirtyFlag = true;
-
- return {
- type: "BooleanLiteral",
- value: true,
- };
- });
-
- root
- .find(j.VariableDeclarator, {
- type: "VariableDeclarator",
- id: {
- type: "ArrayPattern",
- },
- init: {
- type: "AwaitExpression",
- argument: {
- type: "CallExpression",
- callee: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "Promise",
- },
- property: {
- type: "Identifier",
- name: "all",
- },
- },
- arguments: [
- {
- type: "ArrayExpression" as const,
- },
- ],
- },
- },
- })
- .forEach((variableDeclarator) => {
- const { node } = variableDeclarator;
-
- if (node.id.type !== "ArrayPattern") {
- return;
- }
-
- if (node.init?.type !== "AwaitExpression") {
- return;
- }
-
- if (node.init.argument?.type !== "CallExpression") {
- return;
- }
-
- if (node.init.argument.arguments[0]?.type !== "ArrayExpression") {
- return;
- }
-
- const indices: number[] = [];
-
- const { elements } = node.init.argument.arguments[0];
-
- elements.forEach((element, index) => {
- if (element?.type === "BooleanLiteral" && element.value) {
- indices.push(index);
- }
- });
-
- if (indices.length === 0) {
- return;
- }
-
- dirtyFlag = true;
-
- const identifierNames: string[] = [];
-
- node.id.elements
- .filter((_, index) => indices.some((i) => index === i))
- .forEach((element) => {
- if (element?.type === "Identifier") {
- identifierNames.push(element.name);
- }
- });
-
- node.id.elements = node.id.elements.filter(
- (_, index) => !indices.some((i) => index === i),
- );
-
- node.init.argument.arguments[0].elements = elements.filter(
- (_, index) => !indices.some((i) => index === i),
- );
-
- if (node.id.elements.length === 1) {
- const [elementId] = node.id.elements;
- const [initElement] = node.init.argument.arguments[0].elements;
-
- if (
- elementId &&
- elementId.type !== "SpreadElement" &&
- initElement &&
- initElement.type !== "RestElement" &&
- initElement.type !== "SpreadElement"
- ) {
- node.id = elementId;
-
- node.init = {
- type: "AwaitExpression",
- argument: initElement,
- };
- }
- }
-
- const scope = variableDeclarator._computeScope();
-
- if (!scope?.path) {
- return;
- }
-
- identifierNames.forEach((name) => {
- j(scope.path)
- .find(j.Identifier, { name })
- .filter((path) => {
- const parent = path._computeParent();
-
- if (!parent || !("value" in parent)) {
- return true;
- }
-
- return parent.value?.type !== "JSXAttribute";
- })
- .replaceWith(() => {
- dirtyFlag = true;
-
- return {
- type: "BooleanLiteral",
- value: true,
- };
- });
- });
- });
-
- root
- .find(j.LogicalExpression, {
- type: "LogicalExpression",
- left: {
- type: "BooleanLiteral",
- value: true,
- },
- operator: "&&",
- })
- .replaceWith(({ node }) => {
- dirtyFlag = true;
-
- return node.right;
- });
-
- root
- .find(j.LogicalExpression, {
- type: "LogicalExpression",
- right: {
- type: "BooleanLiteral",
- value: true,
- },
- operator: "&&",
- })
- .replaceWith(({ node }) => {
- dirtyFlag = true;
-
- return node.left;
- });
-
- root
- .find(j.AwaitExpression, {
- type: "AwaitExpression",
- argument: {
- type: "BooleanLiteral",
- },
- })
- .replaceWith(({ node }) => {
- dirtyFlag = true;
-
- return node.argument;
- });
-
- return dirtyFlag ? root.toSource() : undefined;
-}
diff --git a/packages/codemods/Feature Flags/remove-unused-feature-flags/test/test.ts b/packages/codemods/Feature Flags/remove-unused-feature-flags/test/test.ts
deleted file mode 100644
index 7a3bb2a85..000000000
--- a/packages/codemods/Feature Flags/remove-unused-feature-flags/test/test.ts
+++ /dev/null
@@ -1,111 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("remove-unused-feature-flags", () => {
- it("should not change code without feature flags", () => {
- const INPUT = `
- const Component = () => {
- return
A
;
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("tsx"), {});
-
- assert.deepEqual(actualOutput, undefined);
- });
-
- it("should remove a feature flag check within Promise.all()", () => {
- const INPUT = `
- const [a, b] = await Promise.all([
- Promise.resolve('a'),
- isFlagEnabled('featureFlag'),
- ]);
-
- const x = b && c;
-
- const y =
- `;
-
- const OUTPUT = `
- const a = await Promise.resolve('a');
-
- const x = c;
-
- const y =
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("tsx"), {});
-
- assert.deepEqual(
- actualOutput?.replace(/\s/gm, ""),
- OUTPUT.replace(/\s/gm, ""),
- );
- });
-
- it("should remove a feature flag check within Promise.all() (with options)", () => {
- const INPUT = `
- const [b, a] = await Promise.all([
- fnc('b'),
- Promise.resolve('a'),
- ]);
-
- const d = () => {
- return c() && b;
- }
- `;
-
- const OUTPUT = `
- const a = await Promise.resolve('a');
-
- const d = () => {
- return c();
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("ts"), {
- functionName: "fnc",
- featureFlagName: "b",
- });
-
- assert.deepEqual(
- actualOutput?.replace(/\s/gm, ""),
- OUTPUT.replace(/\s/gm, ""),
- );
- });
-
- it("should replace await isFlagEnabled('featureFlag') with true", () => {
- const INPUT = `const a = await isFlagEnabled('featureFlag');`;
-
- const OUTPUT = "const a = true;";
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("ts"), {});
-
- assert.deepEqual(
- actualOutput?.replace(/\s/gm, ""),
- OUTPUT.replace(/\s/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/Feature Flags/remove-unused-feature-flags/tsconfig.json b/packages/codemods/Feature Flags/remove-unused-feature-flags/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/Feature Flags/remove-unused-feature-flags/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/Go/remove-unnecessary-nested-block/.codemodrc.json b/packages/codemods/Go/remove-unnecessary-nested-block/.codemodrc.json
deleted file mode 100644
index a3ecc28be..000000000
--- a/packages/codemods/Go/remove-unnecessary-nested-block/.codemodrc.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.0",
- "private": false,
- "name": "remove-unnecessary-nested-block",
- "engine": "piranha",
- "language": "go",
- "meta": {
- "tags": ["migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/Go/remove-unnecessary-nested-block"
- }
-}
diff --git a/packages/codemods/Go/remove-unnecessary-nested-block/package.json b/packages/codemods/Go/remove-unnecessary-nested-block/package.json
deleted file mode 100644
index fc6dce4b8..000000000
--- a/packages/codemods/Go/remove-unnecessary-nested-block/package.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "@codemod-com/codemod-go-remove-unnecessary-nested-block",
- "files": ["./README.md", "./.codemodrc.json"],
- "type": "module",
- "private": true
-}
diff --git a/packages/codemods/Go/remove-unnecessary-nested-block/rules.toml b/packages/codemods/Go/remove-unnecessary-nested-block/rules.toml
deleted file mode 100644
index c775f5094..000000000
--- a/packages/codemods/Go/remove-unnecessary-nested-block/rules.toml
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright (c) 2023 Uber Technologies, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of the License at
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-#
Unless required by applicable law or agreed to in writing, software distributed under the
-# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
-# express or implied. See the License for the specific language governing permissions and
-# limitations under the License.
-
-# adapted from https://github.com/uber/piranha/blob/master/src/cleanup_rules/go/rules.toml#L338-L372
-
-
-
-# Before :
-# {
-# someStepsBefore();
-# {
-# someSteps();
-# }
-# someStepsAfter();
-# }
-# After :
-# {
-# someStepsBefore();
-# someSteps();
-# someStepsAfter();
-# }
-#
-# Note that we need to tag basically all nodes here.
-# Including not so obvious ones: @outer.stmt_list and @outer.block
-[[rules]]
-name = "remove_unnecessary_nested_block"
-query = """
-(
- (block
- (statement_list
- (_)* @pre
- ((block
- (statement_list) @nested.statements
- ) @nested.block)
- (_)* @post
- ) @outer.stmt_list
- ) @outer.block
-)
-"""
-replace = "@nested.statements"
-replace_node = "nested.block"
-is_seed_rule = false
diff --git a/packages/codemods/Java/delete-unused-fields/.codemodrc.json b/packages/codemods/Java/delete-unused-fields/.codemodrc.json
deleted file mode 100644
index a008a7711..000000000
--- a/packages/codemods/Java/delete-unused-fields/.codemodrc.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.0",
- "private": false,
- "name": "Delete Unused Fields",
- "engine": "piranha",
- "language": "java",
- "meta": {
- "tags": ["migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/Java/delete-unused-fields"
- }
-}
diff --git a/packages/codemods/Java/delete-unused-fields/README.md b/packages/codemods/Java/delete-unused-fields/README.md
deleted file mode 100644
index e69de29bb..000000000
diff --git a/packages/codemods/Java/delete-unused-fields/package.json b/packages/codemods/Java/delete-unused-fields/package.json
deleted file mode 100644
index 32de00504..000000000
--- a/packages/codemods/Java/delete-unused-fields/package.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "@codemod-com/codemod-java-delete-unused-fields",
- "files": ["./README.md", "./.codemodrc.json"],
- "type": "module",
- "private": true
-}
diff --git a/packages/codemods/Java/delete-unused-fields/rules.toml b/packages/codemods/Java/delete-unused-fields/rules.toml
deleted file mode 100644
index 256e3f157..000000000
--- a/packages/codemods/Java/delete-unused-fields/rules.toml
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (c) 2023 Uber Technologies, Inc.
-#
-#
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of the License at
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-#
Unless required by applicable law or agreed to in writing, software distributed under the
-# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
-# express or implied. See the License for the specific language governing permissions and
-# limitations under the License.
-
-# adapted from https://github.com/uber/piranha/blob/1de55fa375609473f524e8117df61bf3a790bd36/tests/tests.py#L138
-# changed the Python rule definition into a YAML file
-# Ameya from Uber fixed the query
-
-[[rules]]
-name= "delete_unused_field"
-query = """(
- ((field_declaration
- declarator: (variable_declarator name: (_) @id_name)) @decl)
- (#match? @decl "^private")
- )
-"""
-replace_node="decl"
-replace=""
-
-[[rules.filters]]
-enclosing_node= "(class_declaration ) @c_cd"
-contains = """(
- (identifier) @name
- (#eq? @name "@id_name")
-)"""
-at_most= 1
diff --git a/packages/codemods/antd/5/props-changed-migration/.codemodrc.json b/packages/codemods/antd/5/props-changed-migration/.codemodrc.json
deleted file mode 100644
index 652306537..000000000
--- a/packages/codemods/antd/5/props-changed-migration/.codemodrc.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "name": "antd/props-changed",
- "private": false,
- "engine": "jscodeshift",
- "arguments": [],
- "applicability": {
- "from": [["antd", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ant-design/codemod-v5/tree/main?tab=readme-ov-file#v5-props-changed-migration",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/antd/5/props-changed-migration/README.md b/packages/codemods/antd/5/props-changed-migration/README.md
deleted file mode 100644
index c20eeef9e..000000000
--- a/packages/codemods/antd/5/props-changed-migration/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-This codemod changes the way the component props are applied.
-
-## Example
-
-### Before
-
-```TypeScript
-import { Tag } from 'antd';
-
-const Component = () => {
- const [visible, setVisible] = useState(false);
-
- return ;
-};
-```
-
-### After
-
-```TypeScript
-import { Tag } from 'antd';
-
-const Component = () => {
- const [visible, setVisible] = useState(false);
-
- return (visible ? : null);
-};
-```
\ No newline at end of file
diff --git a/packages/codemods/antd/5/props-changed-migration/package.json b/packages/codemods/antd/5/props-changed-migration/package.json
deleted file mode 100644
index c09d5e410..000000000
--- a/packages/codemods/antd/5/props-changed-migration/package.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name": "@codemod-com/codemod-antd-5-props-changed-migration",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {},
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/antd/5/props-changed-migration/src/ast.ts b/packages/codemods/antd/5/props-changed-migration/src/ast.ts
deleted file mode 100644
index 8009f2e29..000000000
--- a/packages/codemods/antd/5/props-changed-migration/src/ast.ts
+++ /dev/null
@@ -1,94 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://github.com/ant-design/codemod-v5/blob/main/transforms/utils/ast.js
-
-Changes: move the code from JavaScript to TypeScript
-*/
-
-import type {
- ASTPath,
- Collection,
- JSCodeshift,
- JSXAttribute,
- TSParameterProperty,
-} from "jscodeshift";
-
-export const createObjectProperty = (
- j: JSCodeshift,
- key: string,
- value: T,
-) => j.property("init", j.identifier(key), value);
-
-export const createObjectExpression = (j: JSCodeshift, obj: T) =>
- j.objectExpression(
- // @ts-expect-error type ambiguity
- Object.entries(obj).map(([key, val]) =>
- // @ts-expect-error type ambiguity
- createObjectProperty(j, key, val),
- ),
- );
-
-export const getJSXAttributeValue = (
- j: JSCodeshift,
- nodePath: ASTPath,
-) => {
- //
- // 取出来 JSXExpressionContainer 其中值部分
- if (nodePath.value?.value?.type === "JSXExpressionContainer") {
- return nodePath.value.value.expression;
- }
-
- //
- return nodePath.value.value;
-};
-
-export const findAllAssignedNames = (
- root: Collection,
- j: JSCodeshift,
- localAssignedName: string,
- localAssignedNames: string[] = [],
-) => {
- const collection = root.find(j.VariableDeclarator, {
- init: {
- type: "Identifier",
- name: localAssignedName,
- },
- });
-
- if (collection.length > 0) {
- collection.forEach((nodePath) => {
- // @ts-expect-error type ambiguity
- localAssignedNames.push(nodePath.node.id.name);
- findAllAssignedNames(
- root,
- j,
- // @ts-expect-error type ambiguity
- nodePath.node.id.name,
- localAssignedNames,
- );
- });
- }
- return localAssignedNames;
-};
diff --git a/packages/codemods/antd/5/props-changed-migration/src/config.ts b/packages/codemods/antd/5/props-changed-migration/src/config.ts
deleted file mode 100644
index 69646cc41..000000000
--- a/packages/codemods/antd/5/props-changed-migration/src/config.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://github.com/ant-design/codemod-v5/blob/main/transforms/utils/config.js
-
-Changes: move the code from JavaScript to TypeScript
-*/
-
-// https://github.com/benjamn/recast/blob/master/lib/options.ts
-export const printOptions = {
- quote: "single",
-};
diff --git a/packages/codemods/antd/5/props-changed-migration/src/index.ts b/packages/codemods/antd/5/props-changed-migration/src/index.ts
deleted file mode 100644
index 4ae06ba2a..000000000
--- a/packages/codemods/antd/5/props-changed-migration/src/index.ts
+++ /dev/null
@@ -1,481 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://github.com/ant-design/codemod-v5/blob/main/transforms/v5-props-changed-migration.js
-
-Changes to the original file: added TypeScript support
-*/
-
-import type { Collection, JSCodeshift, Transform } from "jscodeshift";
-import {
- createObjectExpression,
- createObjectProperty,
- findAllAssignedNames,
- getJSXAttributeValue,
-} from "./ast.js";
-import { printOptions } from "./config.js";
-
-function parseStrToArray(antdPkgNames: string) {
- return (antdPkgNames || "")
- .split(",")
- .filter((n) => n)
- .map((n) => n.trim());
-}
-
-const changedComponentPropsMap = {
- AutoComplete: {
- dropdownClassName: {
- action: "rename",
- replacer: "popupClassName",
- },
- },
- Cascader: {
- dropdownClassName: {
- action: "rename",
- replacer: "popupClassName",
- },
- },
- Select: {
- dropdownClassName: {
- action: "rename",
- replacer: "popupClassName",
- },
- },
- TreeSelect: {
- dropdownClassName: {
- action: "rename",
- replacer: "popupClassName",
- },
- },
- // 处理 compound components: TimePicker.RangePicker
- TimePicker: {
- dropdownClassName: {
- action: "rename",
- replacer: "popupClassName",
- },
- },
- "TimePicker.RangePicker": {
- dropdownClassName: {
- action: "rename",
- replacer: "popupClassName",
- },
- },
- // 处理 compound components: DatePicker.RangePicker
- DatePicker: {
- dropdownClassName: {
- action: "rename",
- replacer: "popupClassName",
- },
- },
- "DatePicker.RangePicker": {
- dropdownClassName: {
- action: "rename",
- replacer: "popupClassName",
- },
- },
- Mentions: {
- dropdownClassName: {
- action: "rename",
- replacer: "popupClassName",
- },
- },
- Drawer: {
- visible: {
- action: "rename",
- replacer: "open",
- },
- className: {
- action: "rename",
- replacer: "rootClassName",
- },
- style: {
- action: "rename",
- replacer: "rootStyle",
- },
- },
- Modal: {
- visible: {
- action: "rename",
- replacer: "open",
- },
- },
- Dropdown: {
- visible: {
- action: "rename",
- replacer: "open",
- },
- },
- Tooltip: {
- visible: {
- action: "rename",
- replacer: "open",
- },
- },
- Tag: {
- visible: {
- action: "remove",
- },
- },
- Slider: {
- tipFormatter: {
- action: "rename",
- replacer: "tooltip.formatter",
- },
- tooltipPlacement: {
- action: "rename",
- replacer: "tooltip.placement",
- },
- tooltipVisible: {
- action: "rename",
- replacer: "tooltip.open",
- },
- },
- Table: {
- filterDropdownVisible: {
- action: "rename",
- replacer: "filterDropdownOpen",
- },
- },
-};
-
-const transform: Transform = (file, api, options) => {
- const j = api.jscodeshift;
- const root = j(file.source);
- const antdPkgNames = parseStrToArray(options.antdPkgNames || "antd");
-
- // [ [DatePicker], [DatePicker, RangePicker] ]
- const componentTuple = Object.keys(changedComponentPropsMap).map(
- (component) => component.split("."),
- );
-
- function handlePropsTransform(
- collection: Collection,
- componentConfig: (typeof changedComponentPropsMap)[keyof typeof changedComponentPropsMap],
- ) {
- let hasChanged = false;
- Object.keys(componentConfig).forEach((propName) => {
- collection
- .find(j.JSXAttribute, {
- name: {
- type: "JSXIdentifier",
- name: propName,
- },
- })
- .filter((nodePath) => {
- // 只找第一层的 JSXElement 的 Attributes
- return (
- j.JSXOpeningElement.check(nodePath.parent.node) &&
- collection.paths().includes(nodePath.parent.parent)
- );
- })
- .forEach((nodePath) => {
- // @ts-expect-error type ambiguity
- const { action, replacer } = componentConfig[propName];
- if (action === "rename" && replacer) {
- // ->
- if (replacer.includes(".")) {
- const value = getJSXAttributeValue(j, nodePath);
-
- // delete origin `props`
- nodePath.parent.node.attributes =
- nodePath.parent.node.attributes.filter(
- // @ts-expect-error type ambiguity
- (attr) => attr.name.name !== propName,
- );
-
- hasChanged = true;
-
- const [propKey, propSubKey] = replacer.split(".");
- // 检测是否已存在对应的 property 没有则创建一个新的
- // 获取 `Tag` 的 props
- const existedPropKeyAttr = j(nodePath.parent.parent).find(
- j.JSXAttribute,
- {
- name: {
- type: "JSXIdentifier",
- name: propKey,
- },
- },
- );
- if (existedPropKeyAttr.length === 0) {
- const newPropKeyAttr = j.jsxAttribute(
- j.jsxIdentifier(propKey),
- j.jsxExpressionContainer(
- createObjectExpression(j, {
- [propSubKey]: value,
- }),
- ),
- );
-
- // 给对应 property 新增值
- nodePath.parent.node.attributes.push(newPropKeyAttr);
- } else {
- // @ts-expect-error type ambiguity
- existedPropKeyAttr
- .paths()[0]
- // @ts-expect-error type ambiguity
- .value.value.expression.properties.push(
- createObjectProperty(
- j,
- propSubKey,
- // @ts-expect-error type ambiguity
- value,
- ),
- );
- }
- } else {
- // ->
- nodePath.node.name = replacer;
- hasChanged = true;
- }
- }
-
- if (action === "remove") {
- //
- let value = nodePath.value.value;
- //
- // 取出来 JSXExpressionContainer 其中值部分
- if (nodePath.value?.value?.type === "JSXExpressionContainer") {
- // @ts-expect-error type ambiguity
- value = nodePath.value.value.expression;
- }
-
- // delete origin `props`
- nodePath.parent.node.attributes =
- nodePath.parent.node.attributes.filter(
- // @ts-expect-error type ambiguity
- (attr) => attr.name.name !== propName,
- );
-
- hasChanged = true;
-
- //
- // 这种情况直接去掉 visible 即可
-
- // 有 value 再创建条件语句,没有 value 则默认为 true
- // create a conditional expression
- const conditionalExpression = value
- ? j.conditionalExpression(
- value,
- // Component Usage JSXElement ``
- nodePath.parent.parent.node,
- j.nullLiteral(),
- )
- : null;
-
- // <>>
- //
- // return ();
- // <- transform to ->
- // <>{vi && }>
- // {vi && }
- // return (vi && )
-
- if (conditionalExpression) {
- // vi(JSXIdentifier) -> `<`(JSXOpeningElement) -> (JSXElement)
- // -> `<>>`(JSXFragment) | ``(JSXElement)
- if (
- ["JSXElement", "JSXFragment"].includes(
- nodePath.parent.parent.parent.node.type,
- )
- ) {
- const index =
- nodePath.parent.parent.parent.node.children.findIndex(
- // @ts-expect-error type ambiguity
- (n) => n === nodePath.parent.parent.node,
- );
- if (index > -1) {
- nodePath.parent.parent.parent.node.children.splice(
- index,
- 1,
- // add `{}`
- j.jsxExpressionContainer(conditionalExpression),
- );
- }
- } else if (
- ["ReturnStatement"].includes(
- nodePath.parent.parent.parent.node.type,
- )
- ) {
- nodePath.parent.parent.parent.node.argument =
- conditionalExpression;
- }
- }
-
- // 将 jsx element 转为一个条件表达式,并使用小括号包住
- // 最后再检查是不是有一个大的 {} JSXExpressionContainer 包住
- }
- });
- });
-
- return hasChanged;
- }
-
- // import deprecated components from '@ant-design/compatible'
- function handlePropsChanged(j: JSCodeshift, root: Collection) {
- let hasChanged = false;
-
- // import { Tag, Mention } from 'antd';
- // import { Form, Mention } from '@forked/antd';
- root
- .find(j.Identifier)
- .filter(
- (path) =>
- componentTuple.map((n) => n[0]).includes(path.node.name) &&
- path.parent.node.type === "ImportSpecifier" &&
- antdPkgNames.includes(path.parent.parent.node.source.value),
- )
- .forEach((path) => {
- // import { Tag } from 'antd'
- // import { Tag as Tag1 } from 'antd'
- const importedComponentName = path.parent.node.imported.name;
- const localComponentName = path.parent.node.local.name;
-
- const componentConfig =
- // @ts-expect-error type ambiguity
- changedComponentPropsMap[importedComponentName];
-
- const nonCompoundComponent = root.findJSXElements(localComponentName);
- // 处理非 compound component 部分
- if (handlePropsTransform(nonCompoundComponent, componentConfig)) {
- hasChanged = true;
- }
-
- // 处理 compound component 部分
- const compoundComponentTuple = componentTuple.find(
- (n) => n[0] === importedComponentName && n[1],
- );
- const [, compoundComponentName] = compoundComponentTuple || [];
- if (compoundComponentName) {
- //
- // JSXMemberExpression
- const compoundComponent = root.find(j.JSXElement, {
- openingElement: {
- name: {
- type: "JSXMemberExpression",
- object: {
- type: "JSXIdentifier",
- name: localComponentName,
- },
- property: {
- type: "JSXIdentifier",
- name: compoundComponentName,
- },
- },
- },
- });
- if (handlePropsTransform(compoundComponent, componentConfig)) {
- hasChanged = true;
- }
-
- // const { RangePicker } = DatePicker;
- root
- .find(j.VariableDeclarator, {
- init: {
- type: "Identifier",
- name: localComponentName,
- },
- })
- .forEach((path) => {
- // @ts-expect-error type ambiguity
- const localComponentNames = path.node.id.properties
- // @ts-expect-error type ambiguity
- .filter((n) => n.key.name === compoundComponentName)
- // 优先处理解构场景
- // key.name: `const { RangePicker } = DatePicker;`
- // value.name: `const { RangePicker: RP1 } = DatePicker;`
- // @ts-expect-error type ambiguity
- .map((n) => n.value?.name || n.key.name);
- // @ts-expect-error type ambiguity
- localComponentNames.forEach((compoundComponentName) => {
- // 处理反复 reassign 的场景
- const localAssignedNames = findAllAssignedNames(
- root,
- j,
- compoundComponentName,
- [compoundComponentName],
- );
-
- localAssignedNames.forEach((componentName) => {
- const compoundComponent = root.findJSXElements(componentName);
- if (
- handlePropsTransform(compoundComponent, componentConfig)
- ) {
- hasChanged = true;
- }
- });
- });
- });
-
- // const RangerPicker1 = DatePicker.RangePicker;
- // const RangerPicker2 = RangerPicker1;
- root
- .find(j.VariableDeclarator, {
- init: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: localComponentName,
- },
- property: {
- type: "Identifier",
- name: compoundComponentName,
- },
- },
- })
- .forEach((path) => {
- // @ts-expect-error type ambiguity
- const localAssignedName = path.node.id.name;
-
- // 处理反复 reassign 的场景
- const localAssignedNames = findAllAssignedNames(
- root,
- j,
- localAssignedName,
- [localAssignedName],
- );
-
- localAssignedNames.forEach((componentName) => {
- const compoundComponent = root.findJSXElements(componentName);
- if (handlePropsTransform(compoundComponent, componentConfig)) {
- hasChanged = true;
- }
- });
- });
- }
- });
-
- return hasChanged;
- }
-
- // step1. import deprecated components from '@ant-design/compatible'
- // step2. cleanup antd import if empty
- const hasChanged = handlePropsChanged(j, root) || false;
-
- return hasChanged
- ? root.toSource(options.printOptions || printOptions)
- : null;
-};
-
-export default transform;
diff --git a/packages/codemods/antd/5/props-changed-migration/tsconfig.json b/packages/codemods/antd/5/props-changed-migration/tsconfig.json
deleted file mode 100644
index b0c5f0c88..000000000
--- a/packages/codemods/antd/5/props-changed-migration/tsconfig.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": ["./src/**/*.ts"]
-}
diff --git a/packages/codemods/antd/5/remove-style-import/.codemodrc.json b/packages/codemods/antd/5/remove-style-import/.codemodrc.json
deleted file mode 100644
index 21312cc26..000000000
--- a/packages/codemods/antd/5/remove-style-import/.codemodrc.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "name": "antd/remove-style-import",
- "private": false,
- "engine": "jscodeshift",
- "arguments": [],
- "applicability": {
- "from": [["antd", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ant-design/codemod-v5/tree/main?tab=readme-ov-file#v5-remove-style-import",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/antd/5/remove-style-import/README.md b/packages/codemods/antd/5/remove-style-import/README.md
deleted file mode 100644
index 209f55559..000000000
--- a/packages/codemods/antd/5/remove-style-import/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-Comment out the style file import from antd (in js file).
-
-## Example
-
-### Before
-
-```TypeScript
-import 'antd/es/auto-complete/style';
-import 'antd/lib/button/style/index.less';
-import 'antd/dist/antd.compact.min.css';
-
-```
-
-### After
-
-```TypeScript
-// import 'antd/es/auto-complete/style';
-// import 'antd/lib/button/style/index.less';
-// import 'antd/dist/antd.compact.min.css';
-```
\ No newline at end of file
diff --git a/packages/codemods/antd/5/remove-style-import/package.json b/packages/codemods/antd/5/remove-style-import/package.json
deleted file mode 100644
index 6dbfe3c7c..000000000
--- a/packages/codemods/antd/5/remove-style-import/package.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name": "@codemod-com/codemod-antd-5-v5-remove-style-import",
- "dependencies": {
- "@codemod-com/antd5-utils": "workspace:*"
- },
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {},
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/antd/5/remove-style-import/src/index.js b/packages/codemods/antd/5/remove-style-import/src/index.js
deleted file mode 100644
index 7f64bf52a..000000000
--- a/packages/codemods/antd/5/remove-style-import/src/index.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://raw.githubusercontent.com/ant-design/codemod-v5/main/transforms/v5-remove-style-import.js
-
-Changes: migrate imports from cjs to esm
-*/
-
-import { parseStrToArray, printOptions } from "@codemod-com/antd5-utils";
-
-// handle forked antd
-const commentOutStyleImport = [
- // antd/es/auto-complete/style
- /(es|lib)\/.+\/style.*/,
- // antd/dist/antd.compact.min.css
- /dist\/.+\.(less|css)/,
-];
-
-const transform = (file, api, options) => {
- const j = api.jscodeshift;
- const root = j(file.source);
- const antdPkgNames = parseStrToArray(options.antdPkgNames || "antd");
-
- // import 'antd/es/auto-complete/style';
- // import 'antd/dist/antd.compact.min.css';
- function removeStyleImport(j, root) {
- let hasChanged = false;
-
- const regexList = antdPkgNames
- .map((antdPkg) => {
- return new RegExp(
- [
- antdPkg,
- `(${commentOutStyleImport.map((re) => re.source).join("|")})`,
- ].join("/"),
- );
- })
- .concat(
- // import '@ant-design/compatible/assets/index.css';
- new RegExp("@ant-design/compatible/assets/index\\.css"),
- );
-
- // import { Comment, PageHeader } from 'antd';
- // import { Comment, PageHeader } from '@forked/antd';
- root
- .find(j.ImportDeclaration)
- .filter(
- (path) =>
- path.node.source.type === "StringLiteral" &&
- regexList.some((re) => re.test(path.node.source.value)),
- )
- .forEach((path) => {
- hasChanged = true;
- j(path).replaceWith((path) => {
- // 不加空行会导致无法执行 root.toSource()
- const empty = j.emptyStatement();
- // add indent
- empty.comments = [j.commentLine(` ${j(path.node).toSource()}`)];
- return empty;
- });
- });
-
- return hasChanged;
- }
-
- // step1. import deprecated components from '@ant-design/compatible'
- // step2. cleanup antd import if empty
- let hasChanged = false;
- hasChanged = removeStyleImport(j, root) || hasChanged;
-
- return hasChanged
- ? root.toSource(options.printOptions || printOptions)
- : null;
-};
-
-export default transform;
diff --git a/packages/codemods/antd/5/remove-style-import/tsconfig.json b/packages/codemods/antd/5/remove-style-import/tsconfig.json
deleted file mode 100644
index ccfc09ab2..000000000
--- a/packages/codemods/antd/5/remove-style-import/tsconfig.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": ["./src/**/*.{ts,js}"]
-}
diff --git a/packages/codemods/antd/5/removed-component-migration/.codemodrc.json b/packages/codemods/antd/5/removed-component-migration/.codemodrc.json
deleted file mode 100644
index 2cfcb7d57..000000000
--- a/packages/codemods/antd/5/removed-component-migration/.codemodrc.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "name": "antd/remove-component",
- "private": false,
- "engine": "jscodeshift",
- "arguments": [],
- "applicability": {
- "from": [["antd", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ant-design/codemod-v5/tree/main?tab=readme-ov-file#v5-removed-component-migration",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/antd/5/removed-component-migration/README.md b/packages/codemods/antd/5/removed-component-migration/README.md
deleted file mode 100644
index d7eefc231..000000000
--- a/packages/codemods/antd/5/removed-component-migration/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-Replace import for removed component in v5.
-
-## Example
-
-### Before
-
-```TypeScript
-import { Avatar, BackTop, Comment, PageHeader } from 'antd';
-
-```
-
-### After
-
-```TypeScript
-import { Comment } from '@ant-design/compatible';
-import { PageHeader } from '@ant-design/pro-layout';
-import { Avatar, FloatButton } from 'antd';
-```
diff --git a/packages/codemods/antd/5/removed-component-migration/package.json b/packages/codemods/antd/5/removed-component-migration/package.json
deleted file mode 100644
index 402ab7c19..000000000
--- a/packages/codemods/antd/5/removed-component-migration/package.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "@codemod-com/codemod-antd-5-v5-removed-component-migration",
- "dependencies": {
- "@codemod-com/antd5-utils": "workspace:*"
- },
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {},
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/antd/5/removed-component-migration/src/index.js b/packages/codemods/antd/5/removed-component-migration/src/index.js
deleted file mode 100644
index 53008609a..000000000
--- a/packages/codemods/antd/5/removed-component-migration/src/index.js
+++ /dev/null
@@ -1,146 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://github.com/ant-design/codemod-v5/blob/main/transforms/v5-removed-component-migration.js
-Changes to the original file:
-1. changed imports to esm
-2. commented out markDependency
-*/
-
-import {
- addSubmoduleImport,
- parseStrToArray,
- printOptions,
- removeEmptyModuleImport,
-} from "@codemod-com/antd5-utils";
-
-// import { markDependency } from '@codemod-com/antd5-utils/marker';
-
-const removedComponentConfig = {
- Comment: {
- importSource: "@ant-design/compatible",
- },
- PageHeader: {
- importSource: "@ant-design/pro-layout",
- },
- BackTop: {
- importSource: "antd",
- rename: "FloatButton.BackTop",
- },
-};
-
-const transform = (file, api, options) => {
- const j = api.jscodeshift;
- const root = j(file.source);
- const antdPkgNames = parseStrToArray(options.antdPkgNames || "antd");
-
- // import { Comment } from '@ant-design/compatible'
- // import { PageHeader } from '@ant-design/pro-components'
- function importDeprecatedComponent(j, root) {
- let hasChanged = false;
-
- // import { Comment, PageHeader } from 'antd';
- // import { Comment, PageHeader } from '@forked/antd';
- const componentNameList = Object.keys(removedComponentConfig);
-
- root
- .find(j.Identifier)
- .filter(
- (path) =>
- componentNameList.includes(path.node.name) &&
- path.parent.node.type === "ImportSpecifier" &&
- antdPkgNames.includes(path.parent.parent.node.source.value),
- )
- .forEach((path) => {
- hasChanged = true;
- const importedComponentName = path.parent.node.imported.name;
- const antdPkgName = path.parent.parent.node.source.value;
-
- // remove old imports
- const importDeclaration = path.parent.parent.node;
- importDeclaration.specifiers = importDeclaration.specifiers.filter(
- (specifier) =>
- !specifier.imported ||
- specifier.imported.name !== importedComponentName,
- );
-
- // add new import from '@ant-design/compatible'
- const localComponentName = path.parent.node.local.name;
- const importConfig = removedComponentConfig[importedComponentName];
- if (importConfig.rename) {
- if (importConfig.rename.includes(".")) {
- // `FloatButton.BackTop`
- const [newComponentName, compoundComponentName] =
- importConfig.rename.split(".");
- // import part
- const importedLocalName = addSubmoduleImport(j, root, {
- moduleName: importConfig.importSource,
- importedName: newComponentName,
- before: antdPkgName,
- });
- // rename part
- root
- .find(j.JSXElement, {
- openingElement: {
- name: { name: localComponentName },
- },
- })
- .forEach((path) => {
- path.node.openingElement.name = j.jsxMemberExpression(
- j.jsxIdentifier(importedLocalName),
- j.jsxIdentifier(compoundComponentName),
- );
- });
- }
- } else {
- addSubmoduleImport(j, root, {
- moduleName: importConfig.importSource,
- importedName: importedComponentName,
- localName: localComponentName,
- before: antdPkgName,
- });
- // markDependency(importConfig.importSource);
- }
- });
-
- return hasChanged;
- }
-
- // step1. import deprecated components from '@ant-design/compatible'
- // step2. cleanup antd import if empty
- let hasChanged = false;
- hasChanged = importDeprecatedComponent(j, root) || hasChanged;
-
- if (hasChanged) {
- antdPkgNames.forEach((antdPkgName) => {
- removeEmptyModuleImport(j, root, antdPkgName);
- });
- }
-
- return hasChanged
- ? root.toSource(options.printOptions || printOptions)
- : null;
-};
-
-export default transform;
diff --git a/packages/codemods/antd/5/removed-component-migration/tsconfig.json b/packages/codemods/antd/5/removed-component-migration/tsconfig.json
deleted file mode 100644
index ccfc09ab2..000000000
--- a/packages/codemods/antd/5/removed-component-migration/tsconfig.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": ["./src/**/*.{ts,js}"]
-}
diff --git a/packages/codemods/antd/5/removed-static-method-migration/.codemodrc.json b/packages/codemods/antd/5/removed-static-method-migration/.codemodrc.json
deleted file mode 100644
index 0fc83cb13..000000000
--- a/packages/codemods/antd/5/removed-static-method-migration/.codemodrc.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "name": "antd/remove-static-method",
- "private": false,
- "engine": "jscodeshift",
- "arguments": [],
- "applicability": {
- "from": [["antd", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ant-design/codemod-v5/tree/main?tab=readme-ov-file#v5-removed-static-method-migration",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/antd/5/removed-static-method-migration/README.md b/packages/codemods/antd/5/removed-static-method-migration/README.md
deleted file mode 100644
index 01a9065e5..000000000
--- a/packages/codemods/antd/5/removed-static-method-migration/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-Replace message.warn with message.warning.
-Replace notification.close with notification.destroy.
-
-## Example
-
-### Before
-
-```TypeScript
-import { message, notification } from 'antd';
-
-const App = () => {
- const [messageApi, contextHolder] = message.useMessage();
- const onClick1 = () => {
- message.warn();
-
- }
- const onClick2 = () => {
- messageApi.warn();
- };
-
- const [notificationApi] = notification.useNotification();
- const onClick3 = () => {
- notification.close();
- }
- const onClick4 = () => {
- notificationApi.close();
- };
-
- return <>{contextHolder}>;
-};
-
-```
-
-### After
-
-```TypeScript
-import { message, notification } from 'antd';
-
-const App = () => {
- const [messageApi, contextHolder] = message.useMessage();
- const onClick1 = () => {
- message.warning();
- }
- const onClick2 = () => {
- messageApi.warning();
- };
-
- const [notificationApi] = notification.useNotification();
- const onClick3 = () => {
- notification.destroy();
- }
- const onClick4 = () => {
- notificationApi.destroy();
- };
-
- return <>{contextHolder}>;
-};
-```
\ No newline at end of file
diff --git a/packages/codemods/antd/5/removed-static-method-migration/package.json b/packages/codemods/antd/5/removed-static-method-migration/package.json
deleted file mode 100644
index 50a87c831..000000000
--- a/packages/codemods/antd/5/removed-static-method-migration/package.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "@codemod-com/codemod-antd-5-removed-static-method-migration",
- "dependencies": {
- "@codemod-com/antd5-utils": "workspace:*"
- },
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {},
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/antd/5/removed-static-method-migration/src/index.js b/packages/codemods/antd/5/removed-static-method-migration/src/index.js
deleted file mode 100644
index 2864970ed..000000000
--- a/packages/codemods/antd/5/removed-static-method-migration/src/index.js
+++ /dev/null
@@ -1,205 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://github.com/ant-design/codemod-v5/blob/main/transforms/v5-removed-static-method-migration.js
-Changes to the original file: changed imports to esm
-*/
-
-import {
- findAllAssignedNames,
- parseStrToArray,
- printOptions,
-} from "@codemod-com/antd5-utils";
-
-const changedApiMap = {
- message: {
- hook: "useMessage",
- replace: {
- warn: "warning",
- },
- },
- notification: {
- hook: "useNotification",
- replace: {
- close: "destroy",
- },
- },
-};
-
-const transform = (file, api, options) => {
- const j = api.jscodeshift;
- const root = j(file.source);
- const antdPkgNames = parseStrToArray(options.antdPkgNames || "antd");
-
- function replaceDeconstructionAssignCall(msgApiName, importedName) {
- const changedApiConfig = changedApiMap[importedName]?.replace;
- if (changedApiConfig) {
- Object.entries(changedApiConfig).forEach(([oldName, newName]) => {
- // msgApi.warn => msgApi.warning
- root
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: msgApiName,
- },
- property: {
- type: "Identifier",
- name: oldName,
- },
- },
- })
- .forEach((path) => {
- path.node.callee.property.name = newName;
- });
- });
- }
- }
-
- function replaceCallWithIndexZero(aliasedApiName, importedName) {
- const changedApiConfig = changedApiMap[importedName]?.replace;
- if (changedApiConfig) {
- Object.entries(changedApiConfig).forEach(([, newName]) => {
- // msgNamespace[0].warn => msgNamespace[0].warning
- root
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: aliasedApiName,
- },
- property: {
- type: "NumericLiteral",
- value: 0,
- },
- },
- },
- })
- .forEach((path) => {
- path.node.callee.property.name = newName;
- });
- });
- }
- }
-
- function replaceMessageCall(path, importedName) {
- // const [messageApi, contextHolder] = messageAlias;
- if (path.node.id.type === "ArrayPattern") {
- const msgApiName = path.node.id.elements[0].name;
- // 处理反复 reassign 的场景
- const localAssignedNames = findAllAssignedNames(root, j, msgApiName, [
- msgApiName,
- ]);
-
- localAssignedNames.forEach((apiName) => {
- replaceDeconstructionAssignCall(apiName, importedName);
- hasChanged = true;
- });
- } else if (path.node.id.type === "Identifier") {
- // const msg = msg;
- // 处理反复 reassign 的场景
- const msgName = path.node.id.name;
- const localAssignedNames = findAllAssignedNames(root, j, msgName, [
- msgName,
- ]);
-
- localAssignedNames.forEach((apiName) => {
- // const [api] = msg;
- root
- .find(j.VariableDeclarator, {
- init: {
- type: "Identifier",
- name: apiName,
- },
- })
- .forEach((path) => {
- replaceMessageCall(path, importedName);
- hasChanged = true;
- });
-
- replaceCallWithIndexZero(apiName, importedName);
- });
- }
- }
-
- // rename old Message.warn() calls to Message.warning()
- function renameMessageWarnMethodCalls(j, root) {
- let hasChanged = false;
- root
- .find(j.Identifier)
- .filter(
- (path) =>
- Object.keys(changedApiMap).includes(path.node.name) &&
- path.parent.node.type === "ImportSpecifier" &&
- antdPkgNames.includes(path.parent.parent.node.source.value),
- )
- .forEach((path) => {
- const importedName = path.parent.node.imported.name;
- const localComponentName = path.parent.node.local.name;
- // message.warn -> message.warning
- replaceDeconstructionAssignCall(localComponentName, importedName);
- hasChanged = true;
-
- // useMessage called()
- // const [messageApi, contextHolder] = message.useMessage();
- // const msg = message.useMessage();
- const hook = changedApiMap[importedName]?.hook;
- if (hook) {
- root
- .find(j.VariableDeclarator, {
- init: {
- type: "CallExpression",
- callee: {
- type: "MemberExpression",
- property: {
- type: "Identifier",
- name: hook,
- },
- },
- },
- })
- .forEach((path) => {
- replaceMessageCall(path, importedName);
- });
- }
- });
-
- return hasChanged;
- }
-
- // step1. // rename old Model.method() calls
- // step2. cleanup antd import if empty
- let hasChanged = false;
- hasChanged = renameMessageWarnMethodCalls(j, root) || hasChanged;
-
- return hasChanged
- ? root.toSource(options.printOptions || printOptions)
- : null;
-};
-
-export default transform;
diff --git a/packages/codemods/antd/5/removed-static-method-migration/tsconfig.json b/packages/codemods/antd/5/removed-static-method-migration/tsconfig.json
deleted file mode 100644
index ccfc09ab2..000000000
--- a/packages/codemods/antd/5/removed-static-method-migration/tsconfig.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": ["./src/**/*.{ts,js}"]
-}
diff --git a/packages/codemods/antd/5/utils/ast.ts b/packages/codemods/antd/5/utils/ast.ts
deleted file mode 100644
index 8009f2e29..000000000
--- a/packages/codemods/antd/5/utils/ast.ts
+++ /dev/null
@@ -1,94 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://github.com/ant-design/codemod-v5/blob/main/transforms/utils/ast.js
-
-Changes: move the code from JavaScript to TypeScript
-*/
-
-import type {
- ASTPath,
- Collection,
- JSCodeshift,
- JSXAttribute,
- TSParameterProperty,
-} from "jscodeshift";
-
-export const createObjectProperty = (
- j: JSCodeshift,
- key: string,
- value: T,
-) => j.property("init", j.identifier(key), value);
-
-export const createObjectExpression = (j: JSCodeshift, obj: T) =>
- j.objectExpression(
- // @ts-expect-error type ambiguity
- Object.entries(obj).map(([key, val]) =>
- // @ts-expect-error type ambiguity
- createObjectProperty(j, key, val),
- ),
- );
-
-export const getJSXAttributeValue = (
- j: JSCodeshift,
- nodePath: ASTPath,
-) => {
- //
- // 取出来 JSXExpressionContainer 其中值部分
- if (nodePath.value?.value?.type === "JSXExpressionContainer") {
- return nodePath.value.value.expression;
- }
-
- //
- return nodePath.value.value;
-};
-
-export const findAllAssignedNames = (
- root: Collection,
- j: JSCodeshift,
- localAssignedName: string,
- localAssignedNames: string[] = [],
-) => {
- const collection = root.find(j.VariableDeclarator, {
- init: {
- type: "Identifier",
- name: localAssignedName,
- },
- });
-
- if (collection.length > 0) {
- collection.forEach((nodePath) => {
- // @ts-expect-error type ambiguity
- localAssignedNames.push(nodePath.node.id.name);
- findAllAssignedNames(
- root,
- j,
- // @ts-expect-error type ambiguity
- nodePath.node.id.name,
- localAssignedNames,
- );
- });
- }
- return localAssignedNames;
-};
diff --git a/packages/codemods/antd/5/utils/config.js b/packages/codemods/antd/5/utils/config.js
deleted file mode 100644
index 32c6e597e..000000000
--- a/packages/codemods/antd/5/utils/config.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://github.com/ant-design/codemod-v5/blob/main/transforms/utils/config.js
-
-*/
-
-// https://github.com/benjamn/recast/blob/master/lib/options.ts
-export const printOptions = {
- quote: "single",
-};
diff --git a/packages/codemods/antd/5/utils/index.js b/packages/codemods/antd/5/utils/index.js
deleted file mode 100644
index 9aee99000..000000000
--- a/packages/codemods/antd/5/utils/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from "./ast";
-export * from "./config";
-export * from "./marker";
-export * from "./utils";
diff --git a/packages/codemods/antd/5/utils/marker.js b/packages/codemods/antd/5/utils/marker.js
deleted file mode 100644
index b332b36ed..000000000
--- a/packages/codemods/antd/5/utils/marker.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://github.com/ant-design/codemod-v5/blob/main/transforms/utils/marker.js
-
-Changes to the original file:
-1. changed imports to esm
-2. removed getDependencies
-*/
-
-import fs from "fs";
-import os from "os";
-import path from "path";
-
-const markerPath = path.join(
- process.env.NODE_ENV === "local" ? process.cwd() : os.tmpdir(),
- "./antd5-codemod-marker.log",
-);
-
-const newline = "\n";
-
-function ensureFile() {
- return fs.openSync(markerPath, "w");
-}
-
-function markDependency(depName) {
- ensureFile();
- return fs.appendFileSync(markerPath, depName + newline, "utf8");
-}
-
-export { markDependency };
diff --git a/packages/codemods/antd/5/utils/package.json b/packages/codemods/antd/5/utils/package.json
deleted file mode 100644
index 527629878..000000000
--- a/packages/codemods/antd/5/utils/package.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "name": "@codemod-com/antd5-utils",
- "type": "module",
- "exports": "./index.js",
- "private": true,
- "devDependencies": {
- "jscodeshift": "^0.15.1"
- }
-}
diff --git a/packages/codemods/antd/5/utils/utils.js b/packages/codemods/antd/5/utils/utils.js
deleted file mode 100644
index 5a13667ca..000000000
--- a/packages/codemods/antd/5/utils/utils.js
+++ /dev/null
@@ -1,268 +0,0 @@
-/*! @license
-MIT LICENSE
-
-Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-The source code has been taken from https://github.com/ant-design/codemod-v5/blob/main/transforms/utils/index.js
-*/
-
-// some utils extract from https://github.com/reactjs/react-codemod
-function insertImportAfter(j, root, { importStatement, afterModule }) {
- const firstAfterModuleImport = root
- .find(j.ImportDeclaration, {
- source: { value: afterModule },
- })
- .at(0);
-
- if (firstAfterModuleImport.paths()[0]) {
- firstAfterModuleImport.insertAfter(importStatement);
- } else {
- // 保留首行的注释
- // https://github.com/facebook/jscodeshift/blob/master/recipes/retain-first-comment.md
- const firstNode = getFirstNode(j);
- const { comments } = firstNode;
- if (comments) {
- delete firstNode.comments;
- importStatement.comments = comments;
- }
-
- // insert `import` at body(0)
- root.get().node.program.body.unshift(importStatement);
- }
-}
-
-function insertImportBefore(j, root, { importStatement, beforeModule }) {
- const firstBeforeModuleImport = root
- .find(j.ImportDeclaration, {
- source: { value: beforeModule },
- })
- .at(0);
-
- const firstNode = getFirstNode(j, root);
- if (
- (firstBeforeModuleImport.paths()[0] &&
- firstBeforeModuleImport.paths()[0].node === firstNode) ||
- !firstBeforeModuleImport
- ) {
- // 保留首行的注释
- // https://github.com/facebook/jscodeshift/blob/master/recipes/retain-first-comment.md
- const { comments } = firstNode;
- if (comments) {
- delete firstNode.comments;
- importStatement.comments = comments;
- }
- }
-
- if (firstBeforeModuleImport) {
- firstBeforeModuleImport.insertBefore(importStatement);
- } else {
- // insert `import` at body(0)
- root.get().node.program.body.unshift(importStatement);
- }
-}
-
-function hasSubmoduleImport(j, root, moduleName, submoduleName) {
- const collections = root
- .find(j.ImportDeclaration, {
- source: {
- value: moduleName,
- },
- })
- .find(j.ImportSpecifier, {
- imported: {
- name: submoduleName,
- },
- });
-
- const targetImport = collections.paths();
-
- // local 默认设置为 null
- return (
- targetImport[0]?.value?.local?.name || targetImport[0]?.value?.imported.name
- );
-}
-
-function hasModuleImport(j, root, moduleName) {
- return (
- root.find(j.ImportDeclaration, {
- source: { value: moduleName },
- }).length > 0
- );
-}
-
-function hasModuleDefaultImport(j, root, pkgName, localModuleName) {
- let found = false;
- root
- .find(j.ImportDeclaration, {
- source: { value: pkgName },
- })
- .forEach((nodePath) => {
- const defaultImport = nodePath.node.specifiers.filter(
- (n) =>
- n.type === "ImportDefaultSpecifier" &&
- n.local.name === localModuleName,
- );
- if (defaultImport.length) {
- found = true;
- }
- });
- return found;
-}
-
-function removeEmptyModuleImport(j, root, moduleName) {
- root
- .find(j.ImportDeclaration)
- .filter(
- (path) =>
- path.node.specifiers.length === 0 &&
- path.node.source.value === moduleName,
- )
- .replaceWith();
-}
-
-// Program uses var keywords
-function useVar(j, root) {
- return root.find(j.VariableDeclaration, { kind: "const" }).length === 0;
-}
-
-function getFirstNode(j, root) {
- return root.find(j.Program).get("body", 0).node;
-}
-
-function addModuleImport(j, root, { pkgName, importSpecifier, before }) {
- // if has module imported, just import new submodule from existed
- // else just create a new import
- if (hasModuleImport(j, root, pkgName)) {
- root
- .find(j.ImportDeclaration, {
- source: { value: pkgName },
- })
- .at(0)
- .replaceWith(({ node }) => {
- const mergedImportSpecifiers = node.specifiers
- .concat(importSpecifier)
- .sort((a, b) => {
- if (a.type === "ImportDefaultSpecifier") {
- return -1;
- }
-
- if (b.type === "ImportDefaultSpecifier") {
- return 1;
- }
-
- return a.imported.name.localeCompare(b.imported.name);
- });
- return j.importDeclaration(mergedImportSpecifiers, j.literal(pkgName));
- });
- return true;
- }
-
- const importStatement = j.importDeclaration(
- [importSpecifier],
- j.literal(pkgName),
- );
-
- insertImportBefore(j, root, { importStatement, beforeModule: before });
- return true;
-}
-
-// add default import before one module
-function addModuleDefaultImport(j, root, { moduleName, localName, before }) {
- if (hasModuleDefaultImport(j, root, moduleName, localName)) {
- return;
- }
-
- // DefaultImportSpecifier
- const importSpecifier = j.importDefaultSpecifier(j.identifier(localName));
-
- if (
- addModuleImport(j, root, {
- pkgName: moduleName,
- importSpecifier,
- before,
- })
- ) {
- return;
- }
-
- throw new Error(`No ${moduleName} import found!`);
-}
-
-// add submodule import before one module
-function addSubmoduleImport(
- j,
- root,
- { moduleName, importedName, localName, before },
-) {
- const importedLocalName = hasSubmoduleImport(
- j,
- root,
- moduleName,
- importedName,
- );
- if (importedLocalName) {
- return importedLocalName;
- }
-
- const importSpecifier = j.importSpecifier(
- j.identifier(importedName),
- localName ? j.identifier(localName) : null,
- );
-
- if (
- addModuleImport(j, root, {
- pkgName: moduleName,
- importSpecifier,
- before,
- })
- ) {
- return localName || importedName;
- }
-
- throw new Error(`No ${moduleName} import found!`);
-}
-
-// add style import after one module
-function addStyleModuleImport(j, root, { moduleName, after }) {
- if (hasModuleImport(j, root, moduleName)) {
- return;
- }
-
- const importStatement = j.importDeclaration([], j.literal(moduleName));
- insertImportAfter(j, root, { importStatement, afterModule: after });
-}
-
-function parseStrToArray(antdPkgNames) {
- return (antdPkgNames || "")
- .split(",")
- .filter((n) => n)
- .map((n) => n.trim());
-}
-
-export {
- parseStrToArray,
- addModuleDefaultImport,
- addStyleModuleImport,
- addSubmoduleImport,
- removeEmptyModuleImport,
- useVar,
-};
diff --git a/packages/codemods/axios/fetch/.codemodrc.json b/packages/codemods/axios/fetch/.codemodrc.json
deleted file mode 100644
index 9bdf8e283..000000000
--- a/packages/codemods/axios/fetch/.codemodrc.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "name": "axios/fetch",
- "version": "1.0.0",
- "engine": "workflow",
- "private": false,
- "arguments": [
- {
- "kind": "string",
- "name": "OPENAI_API_KEY",
- "required": true
- }
- ],
- "meta": {
- "tags": ["axios", "fetch", "LLM"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/axios/fetch"
- }
-}
diff --git a/packages/codemods/axios/fetch/.gitignore b/packages/codemods/axios/fetch/.gitignore
deleted file mode 100644
index 76add878f..000000000
--- a/packages/codemods/axios/fetch/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules
-dist
\ No newline at end of file
diff --git a/packages/codemods/axios/fetch/LICENSE b/packages/codemods/axios/fetch/LICENSE
deleted file mode 100644
index ff84a5be7..000000000
--- a/packages/codemods/axios/fetch/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2024
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/packages/codemods/axios/fetch/README.md b/packages/codemods/axios/fetch/README.md
deleted file mode 100644
index c0a9a3144..000000000
--- a/packages/codemods/axios/fetch/README.md
+++ /dev/null
@@ -1,68 +0,0 @@
-Migrate from axios to fetch.
-
-Requires `--OPENAI_API_KEY=$OPENAI_API_KEY` to be set.
-
-## Example
-
-### Before
-
-```ts
-const { data } = await axios.get(url, {
- responseType: "arraybuffer",
-});
-```
-
-### After
-
-```ts
-const response = await fetch(url);
-if (!response.ok) throw new Error("Network response was not ok.");
-const data = await response.arrayBuffer();
-```
-
-### Before
-
-```ts
-const { data } = await axios.post(
- `https://app.posthog.com/api/projects/${this.__projectId}/query/`,
- {
- query: {
- kind: "HogQLQuery",
- query:
- "select properties.codemodName, count(*) from events where event in ('codemod.CLI.codemodExecuted', 'codemod.VSCE.codemodExecuted') group by properties.codemodName",
- },
- },
- {
- headers: {
- Authorization: this.__authHeader,
- },
- },
-);
-```
-
-### After
-
-```ts
-const response = await fetch(
- `https://app.posthog.com/api/projects/${this.__projectId}/query/`,
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: this.__authHeader,
- },
- body: JSON.stringify({
- query: {
- kind: "HogQLQuery",
- query:
- "select properties.codemodName, count(*) from events where event in ('codemod.CLI.codemodExecuted', 'codemod.VSCE.codemodExecuted') group by properties.codemodName",
- },
- }),
- },
-);
-if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`);
-}
-const data = await response.json();
-```
-
diff --git a/packages/codemods/axios/fetch/__testfixtures__/fixture1.input.ts b/packages/codemods/axios/fetch/__testfixtures__/fixture1.input.ts
deleted file mode 100644
index e6ef09e31..000000000
--- a/packages/codemods/axios/fetch/__testfixtures__/fixture1.input.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-const { data } = await axios.get(url, {
- responseType: "arraybuffer",
-});
\ No newline at end of file
diff --git a/packages/codemods/axios/fetch/__testfixtures__/fixture1.output.ts b/packages/codemods/axios/fetch/__testfixtures__/fixture1.output.ts
deleted file mode 100644
index 87b5c265e..000000000
--- a/packages/codemods/axios/fetch/__testfixtures__/fixture1.output.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-const response = await fetch(url);
-if (!response.ok) throw new Error("Network response was not ok.");
-const data = await response.arrayBuffer();
\ No newline at end of file
diff --git a/packages/codemods/axios/fetch/__testfixtures__/fixture2.input.ts b/packages/codemods/axios/fetch/__testfixtures__/fixture2.input.ts
deleted file mode 100644
index 0da333077..000000000
--- a/packages/codemods/axios/fetch/__testfixtures__/fixture2.input.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-const { data } = await axios.post(
- `https://app.posthog.com/api/projects/${this.__projectId}/query/`,
- {
- query: {
- kind: "HogQLQuery",
- query:
- "select properties.codemodName, count(*) from events where event in ('codemod.CLI.codemodExecuted', 'codemod.VSCE.codemodExecuted') group by properties.codemodName",
- },
- },
- {
- headers: {
- Authorization: this.__authHeader,
- },
- },
-);
\ No newline at end of file
diff --git a/packages/codemods/axios/fetch/__testfixtures__/fixture2.output.ts b/packages/codemods/axios/fetch/__testfixtures__/fixture2.output.ts
deleted file mode 100644
index be0b60b28..000000000
--- a/packages/codemods/axios/fetch/__testfixtures__/fixture2.output.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-const response = await fetch(
- `https://app.posthog.com/api/projects/${this.__projectId}/query/`,
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: this.__authHeader,
- },
- body: JSON.stringify({
- query: {
- kind: "HogQLQuery",
- query:
- "select properties.codemodName, count(*) from events where event in ('codemod.CLI.codemodExecuted', 'codemod.VSCE.codemodExecuted') group by properties.codemodName",
- },
- }),
- },
-);
-if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`);
-}
-const data = await response.json();
\ No newline at end of file
diff --git a/packages/codemods/axios/fetch/package.json b/packages/codemods/axios/fetch/package.json
deleted file mode 100644
index 888c06342..000000000
--- a/packages/codemods/axios/fetch/package.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name": "fetch",
- "license": "MIT",
- "private": true,
- "devDependencies": {
- "@types/node": "20.9.0",
- "typescript": "^5.2.2",
- "vitest": "^1.0.1",
- "@codemod.com/workflow": "workspace:*"
- },
- "files": ["README.md", ".codemodrc.json", "/dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/axios/fetch/src/index.ts b/packages/codemods/axios/fetch/src/index.ts
deleted file mode 100644
index 9e5c42958..000000000
--- a/packages/codemods/axios/fetch/src/index.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import type { Api } from "@codemod.com/workflow";
-
-export async function workflow({ files }: Api) {
- const prompt = `
- You are migrating from axios to fetch.
- Ignore axios.create() and axios.all().
-
- Here is a general pattern to replace axios with fetch:
- 1. Replace axios.anyFunction(url) with fetch(url, options) and await it.
- 2. if response.ok is false, throw an error.
- 3. Get the response by calling response.json() or response.text() or response.blob() or response.arrayBuffer().
- 4. To be compatible with axios, you need to need to set result variable to { data: await response.json() }.
- 5. Infer the type of result variable from context and apply type to resulve variable { data: await response.json() as SomeType }.
-
- Use AbortSignal to replace axios timeout option.
- For example,
- axios.get(url, { timeout: 5000 })
- can be replaced with
- fetch(url, { signal: AbortSignal.timeout(5000) })
- `;
-
- const axiosPatterns = [
- { pattern: "axios($$$_)" }, // axios()
- { pattern: "axios.$_($$$)" }, // axios.get(...)
- { pattern: "axios.$_($$$).$_($$$)" }, // axios.get(...).then(...)
- { pattern: "axios.$_($$$).$_($$$).$_($$$)" }, // axios.get(...).then(...).catch(...)
- { pattern: "axios.$_($$$).$_($$$).$_($$$).$_($$$)" }, // axios.get(...).then(...).catch(...).finally(...)
- ];
-
- const extendAxiosPatterns = (extend: (pattern: string) => string) =>
- axiosPatterns.map(({ pattern }) => ({
- pattern: extend(pattern),
- }));
-
- await files()
- .jsFam()
- .astGrep({
- rule: {
- any: [
- ...extendAxiosPatterns(
- (pattern) => `const $CONSTANT = await ${pattern}`,
- ),
- ...extendAxiosPatterns(
- (pattern) => `let $VARIABLE = await ${pattern}`,
- ),
- ...extendAxiosPatterns(
- (pattern) => `var $VARIABLE = await ${pattern}`,
- ),
- ...extendAxiosPatterns(
- (pattern) => `const { $$$_ } = await ${pattern}`,
- ),
- ...extendAxiosPatterns(
- (pattern) => `let { $$$_ } = await ${pattern}`,
- ),
- ...extendAxiosPatterns(
- (pattern) => `var { $$$_ } = await ${pattern}`,
- ),
- ...extendAxiosPatterns(
- (pattern) => `const [ $$$_ ] = await ${pattern}`,
- ),
- ...extendAxiosPatterns(
- (pattern) => `let [ $$$_ ] = await ${pattern}`,
- ),
- ...extendAxiosPatterns(
- (pattern) => `var [ $$$_ ] = await ${pattern}`,
- ),
- ...extendAxiosPatterns((pattern) => `$_ = await ${pattern}`),
- ...extendAxiosPatterns((pattern) => `return await ${pattern}`),
- ],
- },
- })
- .ai(prompt);
-
- await files()
- .jsFam()
- .astGrep({ rule: { any: axiosPatterns } })
- .ai(prompt);
-}
diff --git a/packages/codemods/axios/fetch/tsconfig.json b/packages/codemods/axios/fetch/tsconfig.json
deleted file mode 100644
index 329a7d63f..000000000
--- a/packages/codemods/axios/fetch/tsconfig.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "compilerOptions": {
- "baseUrl": ".",
- "outDir": "./dist"
- },
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ],
- "exclude": ["node_modules", "./dist/**/*"],
- "ts-node": {
- "transpileOnly": true
- }
-}
diff --git a/packages/codemods/bull/bullmq/.codemodrc.json b/packages/codemods/bull/bullmq/.codemodrc.json
deleted file mode 100644
index 79fd2bba1..000000000
--- a/packages/codemods/bull/bullmq/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "bull/bullmq",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["bull", ">", "0.0.0"]]
- },
- "meta": {
- "tags": ["migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/bull/bullmq"
- }
-}
diff --git a/packages/codemods/bull/bullmq/README.md b/packages/codemods/bull/bullmq/README.md
deleted file mode 100644
index af74b077e..000000000
--- a/packages/codemods/bull/bullmq/README.md
+++ /dev/null
@@ -1,101 +0,0 @@
-This codemod provides straightforward changes to migrate from bull to bullmq.
-You have to manually create queue names for the existing queues in your application.
-You need to apply these names for the created workers in the files which previously used .process().
-You will have to manually specify connection details if you used `createClient` method on `new Queue()` options before. Connection details should now also be specified for and `Worker` classes.
-
-## Before
-
-```ts
-import Queue from 'bull';
-import Redis from 'ioredis';
-
-export function createQueue(
- name: string,
- defaultJobOptions?: Partial,
-) {
- const queue = new Queue(name, {
- createClient(type) {
- switch (type) {
- case 'client':
- return Redis.defaultClient;
-
- case 'subscriber':
- return Redis.defaultSubscriber;
-
- case 'bclient':
- return new Redis(env.REDIS_URL);
-
- default:
- throw new Error(`Unexpected connection type: ${type}`);
- }
- },
- defaultJobOptions: {
- removeOnComplete: true,
- removeOnFail: true,
- ...defaultJobOptions,
- },
- });
- queue.on('stalled', () => {
- Metrics.increment('bull.jobs.stalled');
- });
- queue.on('completed', () => {
- Metrics.increment('bull.jobs.completed');
- });
- queue.on('error', () => {
- Metrics.increment('bull.jobs.errored');
- });
- queue.on('failed', () => {
- Metrics.increment('bull.jobs.failed');
- });
-
- return queue;
-}
-
-const queue = createQueue('queue-name');
-
-queue.process(async function (job) {
- const event = job.data;
-});
-```
-
-## After
-
-```ts
-import { Queue, DefaultJobOptions, QueueEvents, Worker } from "bullmq";
-import Redis from 'ioredis';
-
-export function createQueue(
- name: string,
- defaultJobOptions?: Partial,
-) {
- const queue = new Queue(name, {
- connection: { host: , port: },
- defaultJobOptions: {
- removeOnComplete: true,
- removeOnFail: true,
- ...defaultJobOptions,
- }
- });
- const queueEvents = new QueueEvents(name);
- queueEvents.on('stalled', () => {
- Metrics.increment("bull.jobs.stalled");
- });
- queueEvents.on('completed', () => {
- Metrics.increment("bull.jobs.completed");
- });
- queueEvents.on('error', () => {
- Metrics.increment("bull.jobs.errored");
- });
- queueEvents.on('failed', () => {
- Metrics.increment("bull.jobs.failed");
- });
-
- return queue;
-}
-
-const queue = createQueue('queue-name');
-
-const worker = new Worker("unknown-name", async function (job) {
- const event = job.data;
-});
-```
\ No newline at end of file
diff --git a/packages/codemods/bull/bullmq/package.json b/packages/codemods/bull/bullmq/package.json
deleted file mode 100644
index 0084855a0..000000000
--- a/packages/codemods/bull/bullmq/package.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name": "@codemod-com/codemod-bull-bullmq",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {},
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/bull/bullmq/src/correct-types.ts b/packages/codemods/bull/bullmq/src/correct-types.ts
deleted file mode 100644
index 9d6fe6424..000000000
--- a/packages/codemods/bull/bullmq/src/correct-types.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { getBullImportSpecifiers } from "./get-import-declaration.js";
-import type { ModifyFunction } from "./types.js";
-
-const typeMapper: Record = {
- JobOptions: "DefaultJobOptions",
-};
-
-// Any references on the right side of queue are meant to be replaced with equivalents
-export const replaceTypeReferences: ModifyFunction = (root, j) => {
- const bullImportSpecifiers = getBullImportSpecifiers(root, j);
-
- if (!bullImportSpecifiers) {
- return;
- }
-
- root.find(j.TSQualifiedName).forEach((path) => {
- const { left, right } = path.value;
-
- if (
- !j.Identifier.check(left) ||
- !j.Identifier.check(right) ||
- left.name !== "Queue"
- ) {
- return;
- }
-
- const newTypeName = typeMapper[right.name];
- bullImportSpecifiers.push({
- type: "ImportSpecifier",
- imported: {
- type: "Identifier",
- name: newTypeName,
- },
- });
-
- const { parentPath } = path;
- if (j.TSTypeReference.check(parentPath.value)) {
- parentPath.value.typeName = {
- type: "Identifier",
- name: newTypeName,
- };
- }
- });
-};
diff --git a/packages/codemods/bull/bullmq/src/get-import-declaration.ts b/packages/codemods/bull/bullmq/src/get-import-declaration.ts
deleted file mode 100644
index c3f8bbb65..000000000
--- a/packages/codemods/bull/bullmq/src/get-import-declaration.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import type core from "jscodeshift";
-import type { Collection } from "jscodeshift";
-
-export const getBullImportDeclaration = (
- root: Collection,
- j: core.JSCodeshift,
-) => {
- const bullImportDeclaration = root
- .find(
- j.ImportDeclaration,
- (declaration) =>
- declaration.source.value === "bull" ||
- declaration.source.value === "bullmq",
- )
- .nodes()
- .at(0);
-
- return bullImportDeclaration ?? null;
-};
-
-export const getBullImportSpecifiers = (
- root: Collection,
- j: core.JSCodeshift,
-) => {
- const declaration = getBullImportDeclaration(root, j);
-
- if (!declaration) {
- return;
- }
-
- const { specifiers: bullImportSpecifiers } = declaration;
-
- return bullImportSpecifiers ?? null;
-};
diff --git a/packages/codemods/bull/bullmq/src/imports.ts b/packages/codemods/bull/bullmq/src/imports.ts
deleted file mode 100644
index 83f1da50a..000000000
--- a/packages/codemods/bull/bullmq/src/imports.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import { getBullImportDeclaration } from "./get-import-declaration.js";
-import type { ModifyFunction } from "./types.js";
-
-export const replaceOldQueueImport: ModifyFunction = (root, j) => {
- const declaration = getBullImportDeclaration(root, j);
-
- if (!declaration) {
- return;
- }
-
- const { source, specifiers: bullImportSpecifiers } = declaration;
-
- if (!bullImportSpecifiers) {
- return;
- }
-
- source.value = "bullmq";
-
- const queueImportIndex = bullImportSpecifiers.findIndex(
- (sp) => sp.local?.name === "Queue",
- );
- const jobOptionsImportIndex = bullImportSpecifiers.findIndex(
- (sp) => sp.local?.name === "JobOptions",
- );
-
- if (queueImportIndex !== -1) {
- bullImportSpecifiers.splice(queueImportIndex, 1);
- bullImportSpecifiers.push({
- type: "ImportSpecifier",
- imported: {
- type: "Identifier",
- name: "Queue",
- },
- });
- }
-
- if (jobOptionsImportIndex !== -1) {
- bullImportSpecifiers.splice(jobOptionsImportIndex, 1);
- bullImportSpecifiers.push({
- type: "ImportSpecifier",
- imported: {
- type: "Identifier",
- name: "JobsOptions",
- },
- });
-
- root.find(j.Identifier).forEach((path) => {
- const { name } = path.value;
- if (name === "JobOptions") {
- path.value.name = "JobsOptions";
- }
- });
- }
-};
diff --git a/packages/codemods/bull/bullmq/src/index.ts b/packages/codemods/bull/bullmq/src/index.ts
deleted file mode 100644
index 2a96323f0..000000000
--- a/packages/codemods/bull/bullmq/src/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import type { API, FileInfo } from "jscodeshift";
-import { replaceTypeReferences } from "./correct-types.js";
-import { replaceOldQueueImport } from "./imports.js";
-import { replaceListeners } from "./listeners.js";
-import { replaceQueueOpts } from "./queue.js";
-import { replaceProcessWithWorkers } from "./worker.js";
-
-export default function transform(
- file: FileInfo,
- api: API,
-): string | undefined {
- const j = api.jscodeshift;
- const root = j(file.source);
-
- replaceOldQueueImport(root, j);
- replaceQueueOpts(root, j);
- replaceTypeReferences(root, j);
-
- replaceListeners(root, j);
- replaceProcessWithWorkers(root, j);
-
- return root.toSource();
-}
diff --git a/packages/codemods/bull/bullmq/src/listeners.ts b/packages/codemods/bull/bullmq/src/listeners.ts
deleted file mode 100644
index 50cfd78ff..000000000
--- a/packages/codemods/bull/bullmq/src/listeners.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import { getBullImportSpecifiers } from "./get-import-declaration.js";
-import type { ModifyFunction } from "./types.js";
-
-export const replaceListeners: ModifyFunction = (root, j) => {
- const bullImportSpecifiers = getBullImportSpecifiers(root, j);
-
- if (!bullImportSpecifiers) {
- return;
- }
-
- // Replace listeners
- root
- .find(j.VariableDeclaration, (vd) => {
- const declarator = vd.declarations.at(0);
-
- if (!j.VariableDeclarator.check(declarator)) {
- return false;
- }
-
- const { init: initializer } = declarator;
- return (
- initializer?.type === "NewExpression" &&
- initializer.callee.type === "Identifier" &&
- initializer.callee.name === "Queue"
- );
- })
- .forEach((declaration) => {
- const realDeclaration = declaration.value.declarations.at(0);
- if (!realDeclaration || realDeclaration.type !== "VariableDeclarator") {
- return;
- }
- const declarationIdentifier =
- realDeclaration.id.type === "Identifier"
- ? realDeclaration.id.name
- : undefined;
- if (!declarationIdentifier) {
- return;
- }
-
- const eventListeners = root.find(
- j.MemberExpression,
- (me) =>
- me.object.type === "Identifier" &&
- me.object.name === declarationIdentifier &&
- me.property.type === "Identifier" &&
- me.property.name === "on",
- );
-
- if (eventListeners.length) {
- bullImportSpecifiers.push({
- type: "ImportSpecifier",
- imported: {
- type: "Identifier",
- name: "QueueEvents",
- },
- });
-
- const eventsDeclaration = j.variableDeclaration("const", [
- j.variableDeclarator(
- j.identifier("queueEvents"),
- j.newExpression(
- j.identifier("QueueEvents"),
- realDeclaration.init?.type === "NewExpression"
- ? realDeclaration.init.arguments.slice(0, 1)
- : [],
- ),
- ),
- ]);
-
- eventListeners.forEach((eventListener) => {
- eventListener.value.object = j.identifier("queueEvents");
- });
-
- declaration.insertAfter(eventsDeclaration);
- }
- });
-};
diff --git a/packages/codemods/bull/bullmq/src/queue.ts b/packages/codemods/bull/bullmq/src/queue.ts
deleted file mode 100644
index eee02c1d6..000000000
--- a/packages/codemods/bull/bullmq/src/queue.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import type { ASTPath } from "jscodeshift";
-import { getBullImportDeclaration } from "./get-import-declaration.js";
-import type { ModifyFunction } from "./types.js";
-
-export const replaceQueueOpts: ModifyFunction = (root, j) => {
- const bullImportDeclaration = getBullImportDeclaration(root, j);
-
- if (!bullImportDeclaration) {
- return;
- }
-
- const queueExpression = root.find(j.NewExpression, {
- callee: {
- type: "Identifier",
- name: "Queue",
- },
- });
-
- if (!queueExpression.length) {
- return;
- }
-
- queueExpression
- .find(j.Identifier, (id) => id.name === "createClient")
- .forEach((id) => {
- // any path
- const parentPath = id.parentPath as ASTPath;
-
- if (typeof parentPath.replace === "function") {
- parentPath.replace(
- j.stringLiteral("connection: { host: redis.host, port: redis.port }"),
- );
- }
- });
-};
diff --git a/packages/codemods/bull/bullmq/src/types.ts b/packages/codemods/bull/bullmq/src/types.ts
deleted file mode 100644
index 4c7065c46..000000000
--- a/packages/codemods/bull/bullmq/src/types.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import type core from "jscodeshift";
-import type { Collection } from "jscodeshift";
-
-export type ModifyFunction = (
- root: Collection,
- j: core.JSCodeshift,
-) => void;
diff --git a/packages/codemods/bull/bullmq/src/worker.ts b/packages/codemods/bull/bullmq/src/worker.ts
deleted file mode 100644
index a5e9fbc06..000000000
--- a/packages/codemods/bull/bullmq/src/worker.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import type { ASTPath, CallExpression } from "jscodeshift";
-import { getBullImportSpecifiers } from "./get-import-declaration.js";
-import type { ModifyFunction } from "./types.js";
-
-export const replaceProcessWithWorkers: ModifyFunction = (root, j) => {
- const bullImportSpecifiers = getBullImportSpecifiers(root, j);
-
- if (!bullImportSpecifiers) {
- return;
- }
-
- const shouldApplyWorkerChanges = root.find(
- j.ImportDeclaration,
- (declaration) => {
- const declarationSource = declaration.source.value?.toString() ?? null;
-
- const { specifiers: imported } = declaration;
- if (!declarationSource || !imported) {
- return false;
- }
-
- // Dumb way to identify proper files to make changes for worker, but at least that makes the circle smaller.
- return (
- declarationSource.includes("bull") ||
- declarationSource.includes("queue") ||
- imported.some((i) => i.local?.name.toLowerCase().includes("queue"))
- );
- },
- );
-
- if (shouldApplyWorkerChanges) {
- root
- .find(
- j.MemberExpression,
- (me) =>
- me.property.type === "Identifier" && me.property.name === "process",
- )
- .forEach((me) => {
- const path = me.parentPath as ASTPath;
- if (!j.CallExpression.check(path.value)) {
- return;
- }
-
- const callBody = path.value.arguments.at(0) ?? null;
- if (!callBody) {
- return;
- }
-
- bullImportSpecifiers.push({
- type: "ImportSpecifier",
- imported: {
- type: "Identifier",
- name: "Worker",
- },
- });
-
- const workerDeclaration = j.variableDeclaration("const", [
- j.variableDeclarator(
- j.identifier("worker"),
- j.newExpression(j.identifier("Worker"), [
- j.stringLiteral("unknown-name"),
- callBody,
- j.stringLiteral(
- "{ connection: { host: redis.host, port: redis.port } }",
- ),
- ]),
- ),
- ]);
-
- path.replace(workerDeclaration);
- });
- }
-};
diff --git a/packages/codemods/bull/bullmq/tsconfig.json b/packages/codemods/bull/bullmq/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/bull/bullmq/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/cal.com/app-directory-boilerplate-calcom/.codemodrc.json b/packages/codemods/cal.com/app-directory-boilerplate-calcom/.codemodrc.json
deleted file mode 100644
index cdc0c35f5..000000000
--- a/packages/codemods/cal.com/app-directory-boilerplate-calcom/.codemodrc.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "cal.com/app-directory-boilerplate-calcom",
- "description": "This codemod provides boilerplate for the app directory.",
- "engine": "filemod",
- "applicability": {
- "from": [["next", ">=", "13.4.0"], ["next", "<", "14.0.0"]]
- },
- "meta": {
- "tags": ["migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/cal.com/app-directory-boilerplate-calcom"
- }
-}
diff --git a/packages/codemods/cal.com/app-directory-boilerplate-calcom/README.md b/packages/codemods/cal.com/app-directory-boilerplate-calcom/README.md
deleted file mode 100644
index 6ead6a0fa..000000000
--- a/packages/codemods/cal.com/app-directory-boilerplate-calcom/README.md
+++ /dev/null
@@ -1,36 +0,0 @@
-The first step to migrate your pages to the `app` directory is to provide a new file structure, respected by the App router.
-
-This is attempted by this codemod, which reads the contents of your `pages` directory and creates the placeholder files.
-
-The placeholder files define the basic layout and page structure.
-
-The boilerplate includes the following:
-
-- placeholder `page.tsx` and `layout.tsx` files which define a UI unique to a route.
-
-If the codemod detects that a `getStaticProps` function is not used, it will be removed. Otherwise, it will remove the `export` keyword from the function definition.
-
-## Example
-
-If you have the following directory:
-
-```
- pages
- ├── a.tsx
- └── b
- └── c.tsx
-
-```
-
-The codemod will generate the following corresponding directory:
-
-```
- app
- ├── a
- └── page.tsx
- └── layout.tsx
- └── b
- └── c
- └── page.tsx
- └── layout.tsx
-```
\ No newline at end of file
diff --git a/packages/codemods/cal.com/app-directory-boilerplate-calcom/package.json b/packages/codemods/cal.com/app-directory-boilerplate-calcom/package.json
deleted file mode 100644
index 68496bd94..000000000
--- a/packages/codemods/cal.com/app-directory-boilerplate-calcom/package.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "name": "@codemod-com/codemod-cal.com-app-directory-boilerplate-calcom",
- "dependencies": {
- "mdast-util-from-markdown": "catalog:",
- "mdast-util-to-markdown": "catalog:",
- "micromark-extension-mdxjs": "catalog:",
- "mdast-util-mdx": "catalog:",
- "unist-util-visit": "catalog:"
- },
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "@codemod-com/filemod": "workspace:*",
- "memfs": "^4.6.0",
- "ts-morph": "^19.0.0",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/cal.com/app-directory-boilerplate-calcom/src/index.ts b/packages/codemods/cal.com/app-directory-boilerplate-calcom/src/index.ts
deleted file mode 100644
index bcfbdbaf7..000000000
--- a/packages/codemods/cal.com/app-directory-boilerplate-calcom/src/index.ts
+++ /dev/null
@@ -1,662 +0,0 @@
-import { format, parse, sep } from "node:path";
-import type { Filemod, HandleData, HandleFile } from "@codemod-com/filemod";
-import type { Identifier, SourceFile } from "ts-morph";
-import tsmorph, { Node, SyntaxKind } from "ts-morph";
-
-type Dependencies = Readonly<{
- tsmorph: typeof tsmorph;
-}>;
-
-const removeLeadingLineBreaks = (input: string): string => {
- return input.replace(/^\n+/, "");
-};
-
-enum FilePurpose {
- ORIGINAL_PAGE = "ORIGINAL_PAGE",
- // route directories
- ROUTE_PAGE = "ROUTE_PAGE",
-}
-
-const map = new Map([
- [FilePurpose.ORIGINAL_PAGE, ""],
- [FilePurpose.ROUTE_PAGE, ""],
-]);
-
-type State = Record;
-
-type DataAPI = Parameters>[0];
-
-type FileCommand = Awaited>>[number];
-type DataCommand = Awaited>>;
-
-const addUseClientStatement = (
- oldPath: string,
- oldData: string,
-): DataCommand => {
- const project = new tsmorph.Project({
- useInMemoryFileSystem: true,
- skipFileDependencyResolution: true,
- compilerOptions: {
- allowJs: true,
- },
- });
-
- const sourceFile = project.createSourceFile(oldPath ?? "", oldData);
-
- const hasUseClient = sourceFile
- .getDescendantsOfKind(SyntaxKind.StringLiteral)
- .some((node) => {
- const literal = node.getLiteralText();
- return literal === "use client";
- });
-
- if (!hasUseClient) {
- sourceFile.insertStatements(0, `'use client';`);
- }
-
- return {
- kind: "upsertData",
- path: oldPath,
- data: sourceFile.getFullText(),
- };
-};
-
-const ROUTE_SEGMENT_CONFIG_OPTIONS = [
- "dynamic",
- "dynamicParams",
- "revalidate",
- "fetchCache",
- "runtime",
- "preferredRegion",
- "maxDuration",
-];
-
-const getAncestorByDeclaration = (declarationNode: Node): Node | null => {
- let ancestor: Node | null = null;
-
- const parameter = Node.isParameterDeclaration(declarationNode)
- ? declarationNode
- : declarationNode.getFirstAncestorByKind(SyntaxKind.Parameter);
- const importDeclaration = declarationNode.getFirstAncestorByKind(
- SyntaxKind.ImportDeclaration,
- );
-
- if (parameter !== undefined) {
- ancestor = parameter;
- } else if (importDeclaration !== undefined) {
- ancestor = importDeclaration;
- } else if (Node.isFunctionDeclaration(declarationNode)) {
- ancestor = declarationNode;
- } else if (Node.isVariableDeclaration(declarationNode)) {
- // variable statement
- ancestor = declarationNode.getParent()?.getParent() ?? null;
- } else if (Node.isBindingElement(declarationNode)) {
- ancestor =
- declarationNode.getFirstAncestorByKind(SyntaxKind.VariableStatement) ??
- null;
- }
-
- return ancestor;
-};
-const DEPENDENCY_TREE_MAX_DEPTH = 3;
-
-const getDependenciesForIdentifiers = (
- identifiers: ReadonlyArray,
- depth = 0,
-) => {
- if (depth > DEPENDENCY_TREE_MAX_DEPTH) {
- return {};
- }
-
- const dependencies: Record = {};
-
- identifiers.forEach((identifier) => {
- const parent = identifier.getParent();
-
- if (Node.isParameterDeclaration(parent)) {
- return;
- }
-
- if (
- (Node.isPropertyAccessExpression(parent) ||
- Node.isElementAccessExpression(parent)) &&
- identifier.getChildIndex() !== 0
- ) {
- return;
- }
-
- if (
- Node.isPropertyAssignment(parent) &&
- parent.getNameNode() === identifier
- ) {
- return;
- }
-
- const [firstDeclaration] = identifier.getSymbol()?.getDeclarations() ?? [];
-
- const localSourceFile = identifier.getFirstAncestorByKind(
- SyntaxKind.SourceFile,
- );
-
- // check if declaration exists in current sourceFile
- if (
- firstDeclaration === undefined ||
- firstDeclaration.getFirstAncestorByKind(SyntaxKind.SourceFile) !==
- localSourceFile
- ) {
- return;
- }
-
- const ancestor = getAncestorByDeclaration(firstDeclaration);
-
- if (ancestor === null) {
- return;
- }
-
- dependencies[identifier.getText()] = ancestor.getText();
-
- // recursivelly check for dependencies until reached parameter or import
- if (
- Node.isImportDeclaration(ancestor) ||
- Node.isParameterDeclaration(ancestor)
- ) {
- return;
- }
-
- const ancestorIdentifiers = ancestor
- .getDescendantsOfKind(SyntaxKind.Identifier)
- .filter((i) => {
- if (i.getText() === identifier.getText()) {
- return false;
- }
-
- if (ancestor && Node.isFunctionDeclaration(ancestor)) {
- const declaration = i.getSymbol()?.getDeclarations()[0];
-
- // ensure we dont collect identifiers from function inner scope in nested functions
- if (
- declaration?.getFirstAncestorByKind(
- SyntaxKind.FunctionDeclaration,
- ) === ancestor
- ) {
- return false;
- }
- }
-
- const parent = i.getParent();
-
- return (
- !Node.isBindingElement(parent) &&
- !Node.isPropertyAssignment(parent) &&
- !(Node.isPropertyAccessExpression(parent) && i.getChildIndex() !== 0)
- );
- });
-
- const dependenciesOfAncestor = getDependenciesForIdentifiers(
- ancestorIdentifiers,
- depth + 1,
- );
- Object.assign(dependencies, dependenciesOfAncestor);
- });
-
- return dependencies;
-};
-
-const getRouteSegmentConfig = (sourceFile: SourceFile): string => {
- let nextjsConfig = "";
-
- sourceFile.getVariableStatements().forEach((statement) => {
- statement.getDeclarations().forEach((declaration) => {
- const id = declaration.getName() ?? "";
-
- if (
- declaration.hasExportKeyword() &&
- ROUTE_SEGMENT_CONFIG_OPTIONS.includes(id)
- ) {
- nextjsConfig += `${statement.getText()} \n`;
- }
- });
- });
-
- return nextjsConfig;
-};
-
-const getServerSideDataHookWithDeps = (sourceFile: SourceFile) => {
- let dataHooksWithDeps = "";
-
- const getDataAF = sourceFile
- .getDescendantsOfKind(SyntaxKind.ArrowFunction)
- .find((AF) => {
- const parent = AF.getParent();
- return (
- Node.isVariableDeclaration(parent) && parent.getName() === "getData"
- );
- });
-
- if (getDataAF === undefined) {
- return dataHooksWithDeps;
- }
-
- const identifiers = getDataAF
- .getBody()
- .getDescendantsOfKind(SyntaxKind.Identifier);
-
- const dependencies = getDependenciesForIdentifiers(identifiers);
-
- dataHooksWithDeps += Object.values(dependencies).reverse().join("\n");
- dataHooksWithDeps += `${
- getDataAF.getFirstAncestorByKind(SyntaxKind.VariableStatement)?.getText() ??
- ""
- } \n`;
-
- return dataHooksWithDeps;
-};
-
-const getPositionAfterImports = (sourceFile: SourceFile): number => {
- const lastImportDeclaration =
- sourceFile.getLastChildByKind(SyntaxKind.ImportDeclaration) ?? null;
-
- return (lastImportDeclaration?.getChildIndex() ?? 0) + 1;
-};
-
-const buildPageFileData = (
- api: DataAPI,
- path: string,
- options: Readonly>,
- filePurpose: FilePurpose.ROUTE_PAGE,
-): DataCommand => {
- const { tsmorph } = api.getDependencies();
-
- const rewriteWithTsMorph = (
- input: string,
- legacyPageData: string,
- ): string => {
- const project = new tsmorph.Project({
- useInMemoryFileSystem: true,
- skipFileDependencyResolution: true,
- compilerOptions: {
- allowJs: true,
- },
- });
-
- const oldPath =
- typeof options.oldPath === "string" ? options.oldPath : null;
-
- const sourceFile = project.createSourceFile(path ?? "", input);
-
- const legacyPageSourceFile = project.createSourceFile(
- oldPath ?? "",
- legacyPageData,
- );
-
- // inserting route segment config to the future page
- const routeSegmentConfig = getRouteSegmentConfig(legacyPageSourceFile);
-
- sourceFile.addStatements(routeSegmentConfig);
-
- // inserting server side data hooks along with its dependencies to the future page
- const serverSideDataHooks =
- getServerSideDataHookWithDeps(legacyPageSourceFile);
-
- const positionAfterImports = getPositionAfterImports(sourceFile);
-
- sourceFile.insertStatements(positionAfterImports, serverSideDataHooks);
-
- sourceFile.getFunctions().forEach((fn) => {
- if (fn.isDefaultExport()) {
- fn.remove();
- return;
- }
-
- const id = fn.getName() ?? "";
-
- if (
- ["getStaticProps", "getServerSideProps", "getStaticPaths"].includes(id)
- ) {
- fn.setIsExported(false);
- }
- });
-
- sourceFile.getVariableStatements().forEach((statement) => {
- statement.getDeclarations().forEach((declaration) => {
- const id = declaration.getName() ?? "";
-
- if (
- ["getStaticProps", "getServerSideProps", "getStaticPaths"].includes(
- id,
- ) &&
- declaration.hasExportKeyword()
- ) {
- statement.setIsExported(false);
- }
- });
- });
-
- sourceFile
- .getDescendantsOfKind(SyntaxKind.JsxOpeningElement)
- .filter(
- (jsxOpeningElement) =>
- jsxOpeningElement.getTagNameNode().getText() === "Head",
- )
- .map((declaration) => {
- return declaration.getFirstAncestorByKind(SyntaxKind.JsxElement);
- })
- .forEach((jsxElement) => {
- const parenthesizedExpressionParent =
- jsxElement?.getParentIfKind(SyntaxKind.ParenthesizedExpression) ??
- null;
-
- if (parenthesizedExpressionParent !== null) {
- parenthesizedExpressionParent.replaceWithText("null");
-
- return;
- }
-
- jsxElement?.replaceWithText("");
- });
-
- if (filePurpose === FilePurpose.ROUTE_PAGE) {
- sourceFile.getImportDeclarations().forEach((declaration) => {
- const moduleSpecifier = declaration.getModuleSpecifierValue();
-
- if (moduleSpecifier.startsWith("./")) {
- declaration.setModuleSpecifier(`.${moduleSpecifier}`);
- } else if (moduleSpecifier.startsWith("../")) {
- declaration.setModuleSpecifier(`../${moduleSpecifier}`);
- }
- });
- }
-
- return sourceFile.getFullText();
- };
-
- return {
- kind: "upsertData",
- path,
- data: rewriteWithTsMorph(
- String(options.oldData ?? ""),
- String(options.legacyPageData ?? ""),
- ),
- };
-};
-
-const SERVER_SIDE_DATA_HOOKS_NAMES = ["getStaticProps", "getServerSideProps"];
-
-const usesServerSideData = (sourceFile: SourceFile) => {
- return (
- sourceFile
- .getFunctions()
- .some((fn) =>
- SERVER_SIDE_DATA_HOOKS_NAMES.includes(fn.getName() ?? ""),
- ) ||
- sourceFile
- .getVariableStatements()
- .some((statement) =>
- statement
- .getDeclarations()
- .some((declaration) =>
- SERVER_SIDE_DATA_HOOKS_NAMES.includes(declaration.getName() ?? ""),
- ),
- )
- );
-};
-
-const usesLayout = (sourceFile: SourceFile) => {
- return sourceFile
- .getImportDeclarations()
- .some(
- (importDeclaration) =>
- importDeclaration.getNamedImports()[0]?.getName() === "getLayout",
- );
-};
-
-const getPageContent = (
- newPagePath: string,
- usesLayout: boolean,
- nestedPathWithoutExtension: string,
-) => {
- if (newPagePath.endsWith("embed")) {
- return `
-import type { Params } from "next/dist/shared/lib/router/utils/route-matcher";
-import { getData } from "../page";
-
-type PageProps = Readonly<{
- params: Params;
-}>;
-
-const Page = ({ params }: PageProps) => {
- await getData(params, true);
-
- return null;
-};
-
-export default Page;`;
- }
- if (newPagePath.includes("(individual-page-wrapper")) {
- return `
-import OldPage from "@pages/${nestedPathWithoutExtension}";
-import { _generateMetadata } from "app/_utils";
-import type { Params } from "next/dist/shared/lib/router/utils/route-matcher";
-import PageWrapper from "@components/PageWrapperAppDir";
-import { headers, cookies } from "next/headers";
-import { buildLegacyCtx } from "@lib/buildLegacyCtx";
-
-${
- usesLayout
- ? 'import { getLayout } from "@calcom/features/MainLayoutAppDir";'
- : ""
-}
-
-export const generateMetadata = async () => await _generateMetadata(() => "", () => "");
-
-type PageProps = Readonly<{
- params: Params;
-}>;
-
-const Page = async ({ params }: PageProps) => {
- const h = headers();
- const nonce = h.get("x-nonce") ?? undefined;
-
- const legacyCtx = buildLegacyCtx(headers(), cookies(), params);
- const props = await getData(legacyCtx);
-
- return (
-
-
-
- );
-};
-
-export default Page;`;
- }
-
- return `
-import Page from "@pages/${nestedPathWithoutExtension}";
-import { _generateMetadata } from "app/_utils";
-
-export const generateMetadata = async () => await _generateMetadata(() => "", () => "");
-
-export default Page;`;
-};
-
-const getNewPagePath = (
- directoryNames: string[],
- fileName: string,
- usesServerSideData: boolean,
- usesLayout: boolean,
-) => {
- const newDirArr = directoryNames.map((name) => {
- if (name !== "pages") {
- return name;
- }
-
- if (usesServerSideData) {
- return "app/future/(individual-page-wrapper)";
- }
-
- if (usesLayout) {
- return "app/future/(shared-page-wrapper)/(layout)";
- }
-
- return "app/future/(shared-page-wrapper)/(no-layout)";
- });
-
- if (fileName !== "index") {
- newDirArr.push(fileName);
- }
-
- return newDirArr.join(sep);
-};
-
-const handleFile: Filemod>["handleFile"] =
- async (api, path, options) => {
- const parsedPath = parse(path);
- const directoryNames = parsedPath.dir.split(sep);
- const endsWithPages =
- directoryNames.length > 0 &&
- directoryNames.lastIndexOf("pages") === directoryNames.length - 1;
-
- const nameIsIndex = parsedPath.name === "index";
-
- if (endsWithPages && nameIsIndex) {
- return [];
- }
-
- const oldData = await api.readFile(path);
-
- if (!endsWithPages) {
- const project = new tsmorph.Project({
- useInMemoryFileSystem: true,
- skipFileDependencyResolution: true,
- compilerOptions: {
- allowJs: true,
- },
- });
-
- const sourceFile = project.createSourceFile(path ?? "", oldData);
-
- const pageUsesServerSideData = usesServerSideData(sourceFile);
- const pageUsesLayout = usesLayout(sourceFile);
-
- const newPagePath = getNewPagePath(
- directoryNames,
- parsedPath.name,
- pageUsesServerSideData,
- pageUsesLayout,
- );
-
- const nestedPathWithoutExtension = `${
- parsedPath.dir.split("/pages/")[1] ?? ""
- }/${parsedPath.name}`;
-
- const pageContent = getPageContent(
- newPagePath,
- pageUsesLayout,
- nestedPathWithoutExtension,
- );
-
- const commands: FileCommand[] = [
- {
- kind: "upsertFile",
- path: format({
- root: parsedPath.root,
- dir: newPagePath,
- ext: parsedPath.ext,
- name: "page",
- }),
- options: {
- ...options,
- filePurpose: FilePurpose.ROUTE_PAGE,
- oldPath: path,
- oldData: removeLeadingLineBreaks(pageContent),
- legacyPageData: oldData,
- },
- },
- {
- kind: "upsertFile",
- path: format({
- root: parsedPath.root,
- dir: parsedPath.dir,
- ext: parsedPath.ext,
- name: parsedPath.name,
- }),
- options: {
- ...options,
- filePurpose: FilePurpose.ORIGINAL_PAGE,
- oldPath: path,
- oldData,
- },
- },
- ];
-
- return commands;
- }
-
- if (parsedPath.name === "_app" || parsedPath.name === "_document") {
- return [
- {
- kind: "deleteFile",
- path,
- },
- ];
- }
-
- return [];
- };
-
-const handleData: HandleData = async (
- api,
- path,
- __,
- options,
-) => {
- try {
- const filePurpose = (options.filePurpose ?? null) as FilePurpose | null;
-
- if (filePurpose === null) {
- return {
- kind: "noop",
- };
- }
-
- const content = map.get(filePurpose) ?? null;
-
- if (content === null) {
- return {
- kind: "noop",
- };
- }
-
- if (filePurpose === FilePurpose.ROUTE_PAGE && options.oldPath) {
- return buildPageFileData(api, path, options, filePurpose);
- }
-
- if (
- filePurpose === FilePurpose.ORIGINAL_PAGE &&
- options.oldPath &&
- options.oldData
- ) {
- return addUseClientStatement(
- String(options.oldPath),
- String(options.oldData),
- );
- }
-
- return {
- kind: "upsertData",
- path,
- data: content,
- };
- } catch (error) {
- return {
- kind: "noop",
- };
- }
-};
-
-export const repomod: Filemod = {
- includePatterns: ["**/pages/**/*.{js,jsx,ts,tsx}"],
- excludePatterns: ["**/node_modules/**", "**/pages/api/**"],
- handleFile,
- handleData,
-};
diff --git a/packages/codemods/cal.com/app-directory-boilerplate-calcom/test/test.ts b/packages/codemods/cal.com/app-directory-boilerplate-calcom/test/test.ts
deleted file mode 100644
index 2207e70a7..000000000
--- a/packages/codemods/cal.com/app-directory-boilerplate-calcom/test/test.ts
+++ /dev/null
@@ -1,443 +0,0 @@
-import { deepStrictEqual, ok } from "node:assert";
-import { buildApi, executeFilemod } from "@codemod-com/filemod";
-import { buildPathAPI, buildUnifiedFileSystem } from "@codemod-com/utilities";
-import type { DirectoryJSON } from "memfs";
-import { Volume, createFsFromVolume } from "memfs";
-import tsmorph from "ts-morph";
-import { describe, it } from "vitest";
-import { repomod } from "../src/index.js";
-
-const transform = async (json: DirectoryJSON) => {
- const volume = Volume.fromJSON(json);
- const fs = createFsFromVolume(volume);
-
- const unifiedFileSystem = buildUnifiedFileSystem(fs);
- const pathApi = buildPathAPI("/");
-
- const api = buildApi<{
- tsmorph: typeof tsmorph;
- }>(
- unifiedFileSystem,
- () => ({
- tsmorph,
- }),
- pathApi,
- );
-
- return executeFilemod(api, repomod, "/", {}, {});
-};
-
-describe("cal.com app-directory-boilerplate-calcom", () => {
- it("should build correct files", async () => {
- const externalFileCommands = await transform({
- "/opt/project/pages/a/index.tsx": "TODO content",
- "/opt/project/pages/a/embed.tsx": "TODO content",
- "/opt/project/pages/a/b.tsx": `
- import { getLayout } from './getLayout';
- export default function B(props) {
- return ;
- }
- B.getLayout = getLayout;
- `,
- "/opt/project/pages/a/[b]/c.tsx": `
- export const getServerSideProps = (ctx) => {
- return null;
- }
- export default function C(props) {
- return ;
- }
- `,
- "/opt/project/pages/a/d.tsx": `
- export const getStaticProps = (ctx) => {
- return null;
- }
- export default function C(props) {
- return ;
- }
- `,
- });
-
- deepStrictEqual(externalFileCommands.length, 10);
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path ===
- "/opt/project/app/future/(shared-page-wrapper)/(no-layout)/a/page.tsx",
- ),
- );
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path === "/opt/project/pages/a/index.tsx",
- ),
- );
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path === "/opt/project/pages/a/embed.tsx",
- ),
- );
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path ===
- "/opt/project/app/future/(shared-page-wrapper)/(layout)/a/b/page.tsx",
- ),
- );
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path === "/opt/project/pages/a/b.tsx",
- ),
- );
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path ===
- "/opt/project/app/future/(individual-page-wrapper)/a/[b]/c/page.tsx",
- ),
- );
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path === "/opt/project/pages/a/[b]/c.tsx",
- ),
- );
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path ===
- "/opt/project/app/future/(individual-page-wrapper)/a/d/page.tsx",
- ),
- );
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path === "/opt/project/pages/a/d.tsx",
- ),
- );
-
- ok(
- externalFileCommands.some((command) => {
- return (
- command.kind === "upsertFile" &&
- command.path ===
- "/opt/project/app/future/(shared-page-wrapper)/(no-layout)/a/embed/page.tsx" &&
- command.newData.replace(/\W/gm, "") ===
- `
- import type { Params } from "next/dist/shared/lib/router/utils/route-matcher";
- import { getData } from "../page";
-
- type PageProps = Readonly<{
- params: Params;
- }>;
-
- const Page = ({ params }: PageProps) => {
- await getData(params, true);
-
- return null;
- };
-
- export default Page;`.replace(/\W/gm, "")
- );
- }),
- );
-
- ok(
- externalFileCommands.some((command) => {
- return (
- command.kind === "upsertFile" &&
- command.path ===
- "/opt/project/app/future/(shared-page-wrapper)/(no-layout)/a/page.tsx" &&
- command.newData.replace(/\W/gm, "") ===
- `
- import Page from "@pages/a/index";
- import { _generateMetadata } from "app/_utils";
-
- export const generateMetadata = async () => await _generateMetadata(() => "", () => "");
- export default Page;
- `.replace(/\W/gm, "")
- );
- }),
- );
-
- ok(
- externalFileCommands.some((command) => {
- return (
- command.kind === "upsertFile" &&
- command.path === "/opt/project/pages/a/index.tsx" &&
- command.newData.replace(/\W/gm, "") ===
- `
- 'use client';
- TODO content
- `.replace(/\W/gm, "")
- );
- }),
- );
-
- ok(
- externalFileCommands.some((command) => {
- return (
- command.kind === "upsertFile" &&
- command.path ===
- "/opt/project/app/future/(shared-page-wrapper)/(layout)/a/b/page.tsx" &&
- command.newData.replace(/\W/gm, "") ===
- `
- import Page from "@pages/a/b";
- import { _generateMetadata } from "app/_utils";
-
- export const generateMetadata = async () => await _generateMetadata(() => "", () => "");
- export default Page;
- `.replace(/\W/gm, "")
- );
- }),
- );
-
- ok(
- externalFileCommands.some((command) => {
- return (
- command.kind === "upsertFile" &&
- command.path === "/opt/project/pages/a/b.tsx" &&
- command.newData.replace(/\W/gm, "") ===
- `
- 'use client';
- import { getLayout } from './getLayout';
- export default function B(props) {
- return ;
- }
- B.getLayout = getLayout;
- `.replace(/\W/gm, "")
- );
- }),
- );
-
- ok(
- externalFileCommands.some((command) => {
- const expected = `
- import OldPage from "@pages/a/[b]/c";
- import { _generateMetadata } from "app/_utils";
- import type { Params } from "next/dist/shared/lib/router/utils/route-matcher";
- import PageWrapper from "@components/PageWrapperAppDir";
- import { headers, cookies } from "next/headers";
- import { buildLegacyCtx } from "@lib/buildLegacyCtx";
-
- export const generateMetadata = async () => await _generateMetadata(() => "", () => "");
-
- type PageProps = Readonly<{
- params: Params;
- }>;
-
- const Page = async ({ params }: PageProps) => {
- const h = headers();
- const nonce = h.get("x-nonce") ?? undefined;
-
- const legacyCtx = buildLegacyCtx(headers(), cookies(), params);
- const props = await getData(legacyCtx);
-
- return (
-
-
-
- );
- };
-
- export default Page;`;
-
- return (
- command.kind === "upsertFile" &&
- command.path ===
- "/opt/project/app/future/(individual-page-wrapper)/a/[b]/c/page.tsx" &&
- command.newData.replace(/\W/gm, "") === expected.replace(/\W/gm, "")
- );
- }),
- );
-
- ok(
- externalFileCommands.some((command) => {
- return (
- command.kind === "upsertFile" &&
- command.path === "/opt/project/pages/a/[b]/c.tsx" &&
- command.newData.replace(/\W/gm, "") ===
- `
- 'use client';
- export const getServerSideProps = (ctx) => {
- return null;
- }
- export default function C(props) {
- return ;
- }
- `.replace(/\W/gm, "")
- );
- }),
- );
-
- ok(
- externalFileCommands.some((command) => {
- const expected = `
- import OldPage from "@pages/a/d";
- import { _generateMetadata } from "app/_utils";
- import type { Params } from "next/dist/shared/lib/router/utils/route-matcher";
- import PageWrapper from "@components/PageWrapperAppDir";
- import { headers, cookies } from "next/headers";
- import { buildLegacyCtx } from "@lib/buildLegacyCtx";
-
- export const generateMetadata = async () => await _generateMetadata(() => "", () => "");
-
- type PageProps = Readonly<{
- params: Params;
- }>;
-
- const Page = async ({ params }: PageProps) => {
- const h = headers();
- const nonce = h.get("x-nonce") ?? undefined;
-
- const legacyCtx = buildLegacyCtx(headers(), cookies(), params);
- const props = await getData(legacyCtx);
-
- return (
-
-
-
- );
- };
-
- export default Page;`;
- return (
- command.kind === "upsertFile" &&
- command.path ===
- "/opt/project/app/future/(individual-page-wrapper)/a/d/page.tsx" &&
- command.newData.replace(/\W/gm, "") === expected.replace(/\W/gm, "")
- );
- }),
- );
-
- ok(
- externalFileCommands.some((command) => {
- return (
- command.kind === "upsertFile" &&
- command.path === "/opt/project/pages/a/d.tsx" &&
- command.newData.replace(/\W/gm, "") ===
- `
- 'use client';
- export const getStaticProps = (ctx) => {
- return null;
- }
- export default function C(props) {
- return ;
- }
- `.replace(/\W/gm, "")
- );
- }),
- );
- });
-
- it("should insert router segment config and server-side data hooks to the future page", async () => {
- const [upsertPageCommand] = await transform({
- "/opt/project/pages/a/index.tsx": `
- import C from 'C';
- import { a } from 'a';
- import b from 'b';
-
- export const getServerSideProps = (ctx) => {
- return a + b;
- }
-
- const getData = () => {
- getServerSideProps();
- }
-
- export default function P() {
- return ;
- }
-
- export const dynamic="force-dynamic";
- `,
- });
-
- deepStrictEqual(upsertPageCommand?.kind, "upsertFile");
- deepStrictEqual(
- upsertPageCommand?.path,
- "/opt/project/app/future/(individual-page-wrapper)/a/page.tsx",
- );
-
- deepStrictEqual(
- upsertPageCommand?.newData.replace(/(?!\.)\s/gm, ""),
- `import OldPage from "@pages/a/index";
- import {_generateMetadata} from "app/_utils";
- import type {Params} from "next/dist/shared/lib/router/utils/route-matcher";
- import PageWrapper from "@components/PageWrapperAppDir";
- import {headers, cookies} from "next/headers";
- import { buildLegacyCtx } from "@lib/buildLegacyCtx";
-
- import b from 'b';
- import { a } from 'a';
- const getServerSideProps = (ctx) => {
- return a + b;
- }
- const getData = () => {
- getServerSideProps();
- }
-
- export const generateMetadata = async ()=> await _generateMetadata(()=>"",()=>"");
- type PageProps=Readonly<{params:Params;}>;
- const Page = async ({params}:PageProps)=>{
- const h=headers();
- const nonce=h.get("x-nonce") ?? undefined;
-
- const legacyCtx = buildLegacyCtx(headers(), cookies(), params);
- const props = await getData(legacyCtx);
-
- return();
- };
- export default Page;
- export const dynamic="force-dynamic";
- `.replace(/(?!\.)\s/gm, ""),
- );
- });
-
- it('should not insert "use client" directive twice', async () => {
- const [, upsertLegacyPage] = await transform({
- "/opt/project/pages/a/index.tsx": `
- 'use client'
- import C from 'C';
-
- export default function P() {
- return ;
- }
-
- `,
- });
-
- deepStrictEqual(upsertLegacyPage?.kind, "upsertFile");
- deepStrictEqual(upsertLegacyPage?.path, "/opt/project/pages/a/index.tsx");
-
- deepStrictEqual(
- upsertLegacyPage?.newData.replace(/(?!\.)\s/gm, ""),
- `'use client'
- import C from 'C';
-
- export default function P() {
- return ;
- }
- `.replace(/(?!\.)\s/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/cal.com/app-directory-boilerplate-calcom/tsconfig.json b/packages/codemods/cal.com/app-directory-boilerplate-calcom/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/cal.com/app-directory-boilerplate-calcom/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/cal.com/generate-metadata-tests-calcom/.codemodrc.json b/packages/codemods/cal.com/generate-metadata-tests-calcom/.codemodrc.json
deleted file mode 100644
index cc5bd0c7f..000000000
--- a/packages/codemods/cal.com/generate-metadata-tests-calcom/.codemodrc.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "name": "generate-metadata-tests",
- "private": false,
- "engine": "filemod",
- "applicability": {
- "from": [["next", ">=", "13.4.0"], ["next", "<", "14.0.0"]]
- },
- "arguments": [
- {
- "name": "testPath",
- "kind": "string",
- "required": true
- }
- ],
- "meta": {
- "tags": ["migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/cal.com/generate-metadata-tests-calcom"
- }
-}
diff --git a/packages/codemods/cal.com/generate-metadata-tests-calcom/README.md b/packages/codemods/cal.com/generate-metadata-tests-calcom/README.md
deleted file mode 100644
index a8dc64b9b..000000000
--- a/packages/codemods/cal.com/generate-metadata-tests-calcom/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-This codemod generates metadata tests for all existing paths under the pages router.
-
-It uses the `testPath` argument to place the test file in the proper place.
\ No newline at end of file
diff --git a/packages/codemods/cal.com/generate-metadata-tests-calcom/package.json b/packages/codemods/cal.com/generate-metadata-tests-calcom/package.json
deleted file mode 100644
index 0aa2bc1a8..000000000
--- a/packages/codemods/cal.com/generate-metadata-tests-calcom/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "@codemod-com/codemod-cal.com-generate-metadata-tests-calcom",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "@codemod-com/filemod": "workspace:*",
- "memfs": "^4.6.0",
- "ts-morph": "^19.0.0",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/cal.com/generate-metadata-tests-calcom/src/index.ts b/packages/codemods/cal.com/generate-metadata-tests-calcom/src/index.ts
deleted file mode 100644
index a3e126c79..000000000
--- a/packages/codemods/cal.com/generate-metadata-tests-calcom/src/index.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-import { parse, sep } from "node:path";
-import type { Filemod, HandleData, HandleFile } from "@codemod-com/filemod";
-
-export const buildData = (appPath: string) => `
- import { expect } from "@playwright/test";
-
- import { test } from "../lib/fixtures";
- import { metadataCommons } from "../lib/metadata";
-
- test.describe("Metadata of ${appPath}", () => {
- test.afterEach(async ({ users }) => {
- await users.deleteAll();
- });
-
- test("emits proper metadata", async ({ page, users }) => {
- const user = await users.create();
- await user.apiLogin();
- await page.goto("${appPath}");
-
- expect(await metadataCommons.getTitle(page)).toMatch(/(TODO|Cal\.com) \| Cal\.com/);
-
- expect(await metadataCommons.getCanonicalLinkHref(page)).toEqual("http://localhost:3000/${appPath}");
-
- expect(await metadataCommons.getAppleTouchIconHref(page)).toEqual("/api/logo?type=apple-touch-icon");
-
- expect(await metadataCommons.getManifestHref(page)).toEqual("/site.webmanifest");
-
- expect(await metadataCommons.getMaskIconHref(page)).toEqual("/safari-pinned-tab.svg");
- expect(await metadataCommons.getMaskIconColor(page)).toEqual("#000000");
-
- expect(await metadataCommons.getLink16Href(page)).toEqual("/api/logo?type=favicon-16");
-
- expect(await metadataCommons.getLink32Href(page)).toEqual("/api/logo?type=favicon-32");
-
- expect(await metadataCommons.getViewportContent(page)).toEqual(
- "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
- );
-
- expect(await metadataCommons.getRobotsContent(page)).toEqual("index,follow");
-
- expect(await metadataCommons.getTileColorContent(page)).toEqual("#ff0000");
-
- expect(await metadataCommons.getLightSchemeName(page)).toEqual("theme-color");
-
- expect(await metadataCommons.getLightSchemeContent(page)).toEqual("#f9fafb");
-
- expect(await metadataCommons.getDarkSchemeName(page)).toEqual("theme-color");
-
- expect(await metadataCommons.getDarkSchemeContent(page)).toEqual("#1C1C1C");
-
- expect(await metadataCommons.getTwitterCardContent(page)).toEqual("summary_large_image");
-
- expect(await metadataCommons.getTwitterSiteContent(page)).toEqual("@calcom");
-
- expect(await metadataCommons.getTwitterAuthorContent(page)).toEqual("@calcom");
-
- expect(await metadataCommons.getOgDescriptionContent(page)).toEqual("TODO");
-
- expect(await metadataCommons.getOgUrlContent(page)).toEqual("http://localhost:3000/${appPath}");
-
- expect(await metadataCommons.getOgTypeContent(page)).toEqual("website");
-
- expect(await metadataCommons.getOgSiteNameContent(page)).toEqual("Cal.com");
-
- expect(await metadataCommons.getOgTitleContent(page)).toMatch(/(TODO|Cal\.com) \| Cal\.com/);
-
- expect(
- (await metadataCommons.getOgImageContent(page))?.startsWith(
- "http://localhost:3000/_next/image?w=1200&q=100&url="
- )
- ).toBeTruthy();
- });
- });
-`;
-
-type Dependencies = Record;
-
-type State = {
- testPath: string | null;
-};
-
-const initializeState: Filemod["initializeState"] = async (
- options,
-) => ({
- testPath: typeof options.testPath === "string" ? options.testPath : null,
-});
-
-const handleFile: HandleFile = async (
- api,
- path,
- options,
- state,
-) => {
- if (state === null || state.testPath === null) {
- return [];
- }
-
- const parsedPath = parse(path);
- const directoryNames = parsedPath.dir.split(sep);
- const endsWithPages =
- directoryNames.length > 0 &&
- directoryNames.lastIndexOf("pages") === directoryNames.length - 1;
-
- const nameIsIndex = parsedPath.name === "index";
-
- if (endsWithPages && nameIsIndex) {
- return [];
- }
-
- const pagesIndex = directoryNames.lastIndexOf("pages");
-
- const paths = directoryNames.slice(pagesIndex + 1);
-
- if (!nameIsIndex) {
- paths.push(parsedPath.name);
- }
-
- const appPath = api.joinPaths(...paths);
-
- paths[paths.length - 1] += ".e2e.ts";
-
- const newPath = api.joinPaths(state.testPath, ...paths);
-
- return [
- {
- kind: "upsertFile",
- path: newPath,
- options: {
- ...options,
- appPath,
- },
- },
- ];
-};
-
-const handleData: HandleData = async (
- _,
- path,
- __,
- options,
-) => {
- const appPath = typeof options.appPath === "string" ? options.appPath : null;
-
- if (appPath === null) {
- return { kind: "noop" };
- }
-
- return {
- kind: "upsertData",
- path,
- data: buildData(appPath),
- };
-};
-
-export const repomod: Filemod = {
- includePatterns: ["**/pages/**/*.{js,jsx,ts,tsx}"],
- excludePatterns: ["**/node_modules/**", "**/pages/api/**"],
- initializeState,
- handleFile,
- handleData,
-};
diff --git a/packages/codemods/cal.com/generate-metadata-tests-calcom/test/test.ts b/packages/codemods/cal.com/generate-metadata-tests-calcom/test/test.ts
deleted file mode 100644
index 7037f436f..000000000
--- a/packages/codemods/cal.com/generate-metadata-tests-calcom/test/test.ts
+++ /dev/null
@@ -1,86 +0,0 @@
-import { deepStrictEqual } from "node:assert";
-import { buildApi, executeFilemod } from "@codemod-com/filemod";
-import { buildPathAPI, buildUnifiedFileSystem } from "@codemod-com/utilities";
-import type { DirectoryJSON } from "memfs";
-import { Volume, createFsFromVolume } from "memfs";
-import { describe, it } from "vitest";
-import { buildData, repomod } from "../src/index.js";
-
-const transform = async (json: DirectoryJSON) => {
- const volume = Volume.fromJSON(json);
- const fs = createFsFromVolume(volume);
-
- const unifiedFileSystem = buildUnifiedFileSystem(fs);
- const pathApi = buildPathAPI("/");
-
- const api = buildApi>(
- unifiedFileSystem,
- () => ({}),
- pathApi,
- );
-
- return executeFilemod(api, repomod, "/", { testPath: "/opt/tests" }, {});
-};
-
-type ExternalFileCommand = Awaited>[number];
-
-const removeWhitespaces = (
- command: ExternalFileCommand,
-): ExternalFileCommand => {
- if (command.kind !== "upsertFile") {
- return command;
- }
-
- return {
- ...command,
- oldData: command.oldData.replace(/\s/, ""),
- newData: command.newData.replace(/\s/, ""),
- };
-};
-
-describe("generate-metadata-tests", () => {
- it("should build correct files", async () => {
- const [command] = await transform({
- "/opt/project/pages/a/index.tsx": "",
- });
-
- const newData = buildData("a").replace(/\s/, "");
-
- deepStrictEqual(removeWhitespaces(command!), {
- kind: "upsertFile",
- path: "/opt/tests/a.e2e.ts",
- oldData: "",
- newData,
- });
- });
-
- it("should build correct files", async () => {
- const [command] = await transform({
- "/opt/project/pages/a/[b].tsx": "",
- });
-
- const newData = buildData("a/[b]").replace(/\s/, "");
-
- deepStrictEqual(removeWhitespaces(command!), {
- kind: "upsertFile",
- path: "/opt/tests/a/[b].e2e.ts",
- oldData: "",
- newData,
- });
- });
-
- it("should build correct files", async () => {
- const [command] = await transform({
- "/opt/project/pages/a/[b]/c.tsx": "",
- });
-
- const newData = buildData("a/[b]/c").replace(/\s/, "");
-
- deepStrictEqual(removeWhitespaces(command!), {
- kind: "upsertFile",
- path: "/opt/tests/a/[b]/c.e2e.ts",
- oldData: "",
- newData,
- });
- });
-});
diff --git a/packages/codemods/cal.com/generate-metadata-tests-calcom/tsconfig.json b/packages/codemods/cal.com/generate-metadata-tests-calcom/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/cal.com/generate-metadata-tests-calcom/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/cal.com/generate-url-patterns/.codemodrc.json b/packages/codemods/cal.com/generate-url-patterns/.codemodrc.json
deleted file mode 100644
index 0f0d2c2ae..000000000
--- a/packages/codemods/cal.com/generate-url-patterns/.codemodrc.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "name": "generate-url-patterns",
- "private": false,
- "engine": "filemod",
- "arguments": [
- {
- "name": "turboPath",
- "kind": "string",
- "required": true
- },
- {
- "name": "middlewarePath",
- "kind": "string",
- "required": true
- },
- {
- "name": "abTestMiddlewarePath",
- "kind": "string",
- "required": true
- },
- {
- "name": "generateAsPageGroup",
- "kind": "boolean",
- "required": false
- }
- ],
- "applicability": {
- "from": [["next", ">=", "13.4.0"], ["next", "<", "14.0.0"]]
- },
- "meta": {
- "tags": ["migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/cal.com/generate-url-patterns"
- }
-}
diff --git a/packages/codemods/cal.com/generate-url-patterns/README.md b/packages/codemods/cal.com/generate-url-patterns/README.md
deleted file mode 100644
index 4f5cba06d..000000000
--- a/packages/codemods/cal.com/generate-url-patterns/README.md
+++ /dev/null
@@ -1 +0,0 @@
-This codemod generates URL Patterns for all existing paths under the apps router to be placed in the middleware file that controls which pages are active.
\ No newline at end of file
diff --git a/packages/codemods/cal.com/generate-url-patterns/package.json b/packages/codemods/cal.com/generate-url-patterns/package.json
deleted file mode 100644
index 131da5a48..000000000
--- a/packages/codemods/cal.com/generate-url-patterns/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "@codemod-com/codemod-cal.com-generate-url-patterns",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "@codemod-com/filemod": "workspace:*",
- "memfs": "^4.6.0",
- "ts-morph": "^19.0.0",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/cal.com/generate-url-patterns/src/index.ts b/packages/codemods/cal.com/generate-url-patterns/src/index.ts
deleted file mode 100644
index d0e063446..000000000
--- a/packages/codemods/cal.com/generate-url-patterns/src/index.ts
+++ /dev/null
@@ -1,472 +0,0 @@
-import { parse, sep } from "node:path";
-import type {
- Filemod,
- HandleData,
- HandleFile,
- HandleFinish,
- InitializeState,
-} from "@codemod-com/filemod";
-import type { TSAsExpressionKind } from "ast-types/gen/kinds.js";
-import type { JSCodeshift } from "jscodeshift";
-
-type Dependencies = { jscodeshift: JSCodeshift };
-
-type State = {
- step: "READING" | "UPSERTING";
- turboPath: string;
- abTestMiddlewarePath: string;
- middlewarePath: string;
- urlPatternEnvVarMap: Map;
- generateAsPageGroup: boolean;
-};
-
-const initializeState: InitializeState = async (
- options,
- previousState,
-) => {
- if (previousState !== null) {
- return {
- ...previousState,
- step: "UPSERTING",
- };
- }
-
- const {
- turboPath,
- abTestMiddlewarePath,
- middlewarePath,
- generateAsPageGroup,
- } = options;
-
- if (typeof turboPath !== "string") {
- throw new Error("The turbo.json absolute path has not been defined");
- }
-
- if (typeof abTestMiddlewarePath !== "string") {
- throw new Error("The abTestMiddleware absolute path has not been defined");
- }
-
- if (typeof middlewarePath !== "string") {
- throw new Error("The middleware.ts absolute path has not been defined");
- }
-
- return {
- step: "READING",
- turboPath,
- abTestMiddlewarePath,
- middlewarePath,
- urlPatternEnvVarMap: new Map(),
- generateAsPageGroup: Boolean(generateAsPageGroup),
- };
-};
-
-const COMMON_PART_REGEX = /^(?[a-zA-Z0-9-_]+)$/;
-const DYNAMIC_SEGMENT_PART_REGEX = /^\[(?[a-zA-Z0-9-_]+)\]$/;
-const CATCH_ALL_DYNAMIC_SEGMENT_PART_REGEX =
- /^\[\.{3}(?[a-zA-Z0-9-_]+)\]$/;
-const OPTIONAL_CATCH_ALL_DYNAMIC_SEGMENT_PART_REGEX =
- /^\[{2}\.{3}(?[a-zA-Z0-9-_]+)\]{2}$/;
-
-const isNeitherNullNorUndefined = (
- t: NonNullable | null | undefined,
-): t is NonNullable => t !== null && t !== undefined;
-
-const getRegexGroups = (part: string) => {
- const regExpExecArray =
- COMMON_PART_REGEX.exec(part) ??
- DYNAMIC_SEGMENT_PART_REGEX.exec(part) ??
- CATCH_ALL_DYNAMIC_SEGMENT_PART_REGEX.exec(part) ??
- OPTIONAL_CATCH_ALL_DYNAMIC_SEGMENT_PART_REGEX.exec(part);
-
- return regExpExecArray?.groups ?? {};
-};
-
-const buildEnvVarNameFromPathParts = (pathParts: string[]) => {
- const partialEnvVar = pathParts
- .map((part) => {
- const { cpart, dspart, cadspart, ocadspart } = getRegexGroups(part);
-
- const somePart = cpart ?? dspart ?? cadspart ?? ocadspart ?? null;
-
- return somePart?.replace(/-/g, "_").toUpperCase() ?? null;
- })
- .filter(isNeitherNullNorUndefined)
- .join("_");
-
- return ["APP_ROUTER", partialEnvVar, "ENABLED"].join("_");
-};
-
-const handleFile: HandleFile = async (
- _,
- path,
- options,
- state,
-) => {
- if (state === null) {
- throw new Error("The state is not set");
- }
-
- if (state.step === "READING") {
- const parsedPath = parse(path);
- const directoryNames = parsedPath.dir.split(sep);
-
- if (!directoryNames.includes("app") || parsedPath.name !== "page") {
- return [];
- }
-
- const parts = directoryNames
- .slice(directoryNames.lastIndexOf("app") + 1)
- .filter((part) => part !== "future");
-
- if (state.generateAsPageGroup) {
- const [topLevelPageName] = parts;
-
- state.urlPatternEnvVarMap.set(
- `/${topLevelPageName}/:path*`,
- buildEnvVarNameFromPathParts([topLevelPageName]),
- );
-
- return [];
- }
-
- if (parts.length === 0) {
- return [];
- }
-
- const pathname = parts
- .map((part) => {
- const { cpart, dspart, cadspart, ocadspart } = getRegexGroups(part);
-
- if (cpart !== undefined) {
- return cpart;
- }
-
- if (dspart !== undefined) {
- return `:${dspart}`;
- }
-
- if (cadspart !== undefined) {
- return `:${cadspart}+`;
- }
-
- if (ocadspart !== undefined) {
- return `:${ocadspart}*`;
- }
-
- return null;
- })
- .filter(isNeitherNullNorUndefined)
- .map((part) => `/${part}`)
- .join("");
-
- const envVar = buildEnvVarNameFromPathParts(parts);
-
- state.urlPatternEnvVarMap.set(pathname, envVar);
-
- return [];
- }
-
- if (
- [
- state.turboPath,
- state.middlewarePath,
- state.abTestMiddlewarePath,
- ].includes(path)
- ) {
- return [
- {
- kind: "upsertFile",
- path,
- options,
- },
- ];
- }
-
- return [];
-};
-
-const handleData: HandleData = async (
- api,
- path,
- data,
- _,
- state,
-) => {
- if (state === null) {
- throw new Error("The state is not set");
- }
-
- if (path === state.turboPath) {
- const json = JSON.parse(data);
-
- const globalEnv = new Set(json.globalEnv);
-
- for (const envVar of state.urlPatternEnvVarMap.values()) {
- globalEnv.add(envVar);
- }
-
- const newData = JSON.stringify({
- ...json,
- globalEnv: Array.from(globalEnv).sort(),
- });
-
- return {
- kind: "upsertData",
- path,
- data: newData,
- };
- }
-
- // adds page paths to the matcher
- if (path === state.middlewarePath) {
- const { jscodeshift } = api.getDependencies();
- const j = jscodeshift.withParser("tsx");
- const root = j(data);
-
- root.find(j.VariableDeclaration).forEach((path) => {
- if (path.node.declarations[0].type !== "VariableDeclarator") {
- return;
- }
-
- const declarator = path.node.declarations[0];
-
- if (
- !j.Identifier.check(declarator.id) ||
- declarator.id.name !== "config"
- ) {
- return;
- }
-
- if (!j.ObjectExpression.check(declarator.init)) {
- return;
- }
-
- const matcherProperty = declarator.init.properties.find(
- (prop) =>
- j.ObjectProperty.check(prop) &&
- j.Identifier.check(prop.key) &&
- prop.key.name === "matcher",
- );
-
- if (
- matcherProperty === null ||
- !j.ObjectProperty.check(matcherProperty) ||
- !j.ArrayExpression.check(matcherProperty.value)
- ) {
- return;
- }
-
- const urlPatterns = state.urlPatternEnvVarMap.keys();
- const literals = [...urlPatterns].flatMap((urlPattern) => [
- j.literal(urlPattern),
- j.literal(`/future${urlPattern}/`),
- ]);
-
- matcherProperty.value.elements.push(...literals);
- });
-
- return { kind: "upsertData", path, data: root.toSource() };
- }
-
- if (path === state.abTestMiddlewarePath) {
- const { jscodeshift } = api.getDependencies();
- const { VariableDeclarator, Program } = jscodeshift;
- const root = jscodeshift.withParser("tsx")(data);
-
- const buildElement = (
- pathname: string,
- envVar: string,
- ): TSAsExpressionKind => {
- return {
- type: "TSAsExpression",
- expression: {
- type: "ArrayExpression",
- elements: [
- {
- type: "StringLiteral",
- value: pathname,
- },
- {
- type: "CallExpression",
- callee: {
- type: "Identifier",
- name: "Boolean",
- },
- arguments: [
- {
- type: "MemberExpression",
- object: {
- type: "MemberExpression",
- object: {
- type: "Identifier",
- name: "process",
- },
- property: {
- type: "Identifier",
- name: "env",
- },
- },
- property: {
- type: "Identifier",
- name: envVar,
- },
- },
- ],
- },
- ],
- },
- typeAnnotation: {
- type: "TSTypeReference",
- typeName: {
- type: "Identifier",
- name: "const",
- },
- },
- };
- };
-
- const elements = Array.from(state.urlPatternEnvVarMap)
- .sort((a, b) => a[0].localeCompare(b[0]))
- .map((entry) => buildElement(...entry));
-
- const variableDeclarator = jscodeshift.variableDeclarator(
- {
- type: "Identifier",
- name: "ROUTES",
- typeAnnotation: {
- type: "TSTypeAnnotation",
- typeAnnotation: {
- type: "TSArrayType",
- elementType: {
- type: "TSTupleType",
- elementTypes: [
- {
- type: "TSTypeReference",
- typeName: {
- type: "Identifier",
- name: "URLPattern",
- },
- },
- {
- type: "TSBooleanKeyword",
- },
- ],
- },
- },
- },
- },
- {
- type: "CallExpression",
- callee: {
- type: "MemberExpression",
- object: {
- type: "ArrayExpression",
- elements,
- },
- property: {
- type: "Identifier",
- name: "map",
- },
- },
- arguments: [
- {
- type: "ArrowFunctionExpression",
- params: [
- {
- type: "ArrayPattern",
- elements: [
- {
- type: "Identifier",
- name: "pathname",
- },
- {
- type: "Identifier",
- name: "enabled",
- },
- ],
- },
- ],
- body: {
- type: "ArrayExpression",
- elements: [
- {
- type: "NewExpression",
- callee: {
- type: "Identifier",
- name: "URLPattern",
- },
- arguments: [
- {
- type: "ObjectExpression",
- properties: [
- {
- type: "ObjectProperty",
- key: {
- type: "Identifier",
- name: "pathname",
- },
- value: {
- type: "Identifier",
- name: "pathname",
- },
- shorthand: true,
- },
- ],
- },
- ],
- },
- {
- type: "Identifier",
- name: "enabled",
- },
- ],
- },
- },
- ],
- },
- );
-
- const routesVariableDeclarators = root.find(VariableDeclarator, {
- type: "VariableDeclarator",
- id: {
- type: "Identifier",
- name: "ROUTES",
- },
- });
-
- if (routesVariableDeclarators.length === 0) {
- const variableDeclation = jscodeshift.variableDeclaration("const", [
- variableDeclarator,
- ]);
-
- root.find(Program).nodes()[0]?.body.push(variableDeclation);
- } else {
- routesVariableDeclarators.replaceWith(() => variableDeclarator);
- }
-
- const source = root.toSource();
-
- return { kind: "upsertData", path, data: source };
- }
-
- return { kind: "noop" };
-};
-
-const handleFinish: HandleFinish = async (_, state) => {
- if (state === null) {
- throw new Error("The state is not set");
- }
-
- return {
- kind: state.step === "READING" ? "restart" : "noop",
- };
-};
-
-export const repomod: Filemod = {
- includePatterns: ["**/*.{js,jsx,ts,tsx,json}"],
- excludePatterns: ["**/node_modules/**", "**/pages/api/**"],
- initializeState,
- handleFile,
- handleData,
- handleFinish,
-};
diff --git a/packages/codemods/cal.com/generate-url-patterns/test/test.ts b/packages/codemods/cal.com/generate-url-patterns/test/test.ts
deleted file mode 100644
index fd4192585..000000000
--- a/packages/codemods/cal.com/generate-url-patterns/test/test.ts
+++ /dev/null
@@ -1,223 +0,0 @@
-import { deepStrictEqual } from "node:assert";
-import { buildApi, executeFilemod } from "@codemod-com/filemod";
-import { buildPathAPI, buildUnifiedFileSystem } from "@codemod-com/utilities";
-import jscodeshift from "jscodeshift";
-import type { DirectoryJSON } from "memfs";
-import { Volume, createFsFromVolume } from "memfs";
-import { describe, it } from "vitest";
-import { repomod } from "../src/index.js";
-
-const transform = async (
- json: DirectoryJSON,
- options: {
- turboPath: string;
- abTestMiddlewarePath: string;
- middlewarePath: string;
- generateAsPageGroup?: boolean;
- },
-) => {
- const volume = Volume.fromJSON(json);
-
- const fs = createFsFromVolume(volume);
-
- const unifiedFileSystem = buildUnifiedFileSystem(fs);
- const pathApi = buildPathAPI("/");
-
- const api = buildApi<{ jscodeshift: typeof jscodeshift }>(
- unifiedFileSystem,
- () => ({
- jscodeshift,
- }),
- pathApi,
- );
-
- return executeFilemod(api, repomod, "/", options, {});
-};
-
-type ExternalFileCommand = Awaited>[number];
-
-const removeWhitespaces = (
- command: ExternalFileCommand,
-): ExternalFileCommand => {
- if (command.kind !== "upsertFile") {
- return command;
- }
-
- return {
- ...command,
- oldData: command.oldData.replace(/\s/gm, ""),
- newData: command.newData.replace(/\s/gm, ""),
- };
-};
-
-const turboContent = JSON.stringify({
- globalEnv: ["OTHER_ENVVAR"],
-});
-
-const abTestMiddlewareContent = `
- import { type X } from 'y';
- const other = true;
-`;
-const middlewareContent = `
- export const config = {
- matcher: [
- "otherPath",
- ]
- }
-`;
-
-describe("generate-url-patterns", () => {
- it("should build correct files", async () => {
- const [turboJsonCommand, middlewareTsCommand, abTestMiddlewareTsCommand] =
- await transform(
- {
- "/opt/project/turbo.json": turboContent,
- "/opt/project/abTestMiddleware.ts": abTestMiddlewareContent,
- "/opt/project/middleware.ts": middlewareContent,
- "/opt/project/app/future/noSegment/page.tsx": "",
- "/opt/project/app/future/dynamicSegment/[a]/page.tsx": "",
- "/opt/project/app/future/dynamicSegment/[b]/[c]/page.tsx": "",
- "/opt/project/app/future/catchAllDynamicSegments/[...d]/page.tsx": "",
- "/opt/project/app/future/(someLayout)/optionalCatchAllDynamicSegments/[[...element]]/f/page.tsx":
- "",
- },
- {
- turboPath: "/opt/project/turbo.json",
- abTestMiddlewarePath: "/opt/project/abTestMiddleware.ts",
- middlewarePath: "/opt/project/middleware.ts",
- },
- );
-
- const newData = JSON.stringify({
- globalEnv: [
- "APP_ROUTER_CATCHALLDYNAMICSEGMENTS_D_ENABLED",
- "APP_ROUTER_DYNAMICSEGMENT_A_ENABLED",
- "APP_ROUTER_DYNAMICSEGMENT_B_C_ENABLED",
- "APP_ROUTER_NOSEGMENT_ENABLED",
- "APP_ROUTER_OPTIONALCATCHALLDYNAMICSEGMENTS_ELEMENT_F_ENABLED",
- "OTHER_ENVVAR",
- ],
- });
-
- deepStrictEqual(removeWhitespaces(turboJsonCommand!), {
- kind: "upsertFile",
- path: "/opt/project/turbo.json",
- oldData: turboContent,
- newData,
- });
-
- deepStrictEqual(
- removeWhitespaces(abTestMiddlewareTsCommand!),
- removeWhitespaces({
- kind: "upsertFile",
- path: "/opt/project/abTestMiddleware.ts",
- oldData: abTestMiddlewareContent,
- newData: `import { type X } from 'y';
- const other = true;
-
- const ROUTES: [URLPattern, boolean][] = [
- [
- "/catchAllDynamicSegments/:d+",
- Boolean(process.env.APP_ROUTER_CATCHALLDYNAMICSEGMENTS_D_ENABLED)
- ] as const,
- [
- "/dynamicSegment/:a",
- Boolean(process.env.APP_ROUTER_DYNAMICSEGMENT_A_ENABLED)
- ] as const,
- [
- "/dynamicSegment/:b/:c",
- Boolean(process.env.APP_ROUTER_DYNAMICSEGMENT_B_C_ENABLED)
- ] as const,
- ["/noSegment", Boolean(process.env.APP_ROUTER_NOSEGMENT_ENABLED)] as const,
- [
- "/optionalCatchAllDynamicSegments/:element*/f",
- Boolean(process.env.APP_ROUTER_OPTIONALCATCHALLDYNAMICSEGMENTS_ELEMENT_F_ENABLED)
- ] as const
- ].map(([pathname, enabled]) => [new URLPattern({
- pathname
- }), enabled]);
-`,
- }),
- );
-
- deepStrictEqual(
- removeWhitespaces(middlewareTsCommand!),
- removeWhitespaces({
- kind: "upsertFile",
- path: "/opt/project/middleware.ts",
- oldData: middlewareContent,
- newData: `
- export const config = {
- matcher: [
- "otherPath",
- "/noSegment",
- "/future/noSegment/",
-
- "/dynamicSegment/:a",
- "/future/dynamicSegment/:a/",
-
- "/catchAllDynamicSegments/:d+",
- "/future/catchAllDynamicSegments/:d+/",
-
- "/dynamicSegment/:b/:c",
- "/future/dynamicSegment/:b/:c/",
-
- "/optionalCatchAllDynamicSegments/:element*/f",
- "/future/optionalCatchAllDynamicSegments/:element*/f/"
- ]
- }
- `,
- }),
- );
- });
-
- it("should support generateAsPageGroup option", async () => {
- const [turboJsonCommand, abTestMiddlewareTsCommand] = await transform(
- {
- "/opt/project/turbo.json": turboContent,
- "/opt/project/abTestMiddleware.ts": abTestMiddlewareContent,
- "/opt/project/app/future/top-level/page.tsx": "",
- "/opt/project/app/future/top-level/a/page.tsx": "",
- "/opt/project/app/future/top-level/b/page.tsx": "",
- "/opt/project/app/future/top-level/a/b/page.tsx": "",
- },
- {
- turboPath: "/opt/project/turbo.json",
- abTestMiddlewarePath: "/opt/project/abTestMiddleware.ts",
- middlewarePath: "/opt/project/middleware.ts",
- generateAsPageGroup: true,
- },
- );
-
- const newData = JSON.stringify({
- globalEnv: ["APP_ROUTER_TOP_LEVEL_ENABLED", "OTHER_ENVVAR"],
- });
-
- deepStrictEqual(removeWhitespaces(turboJsonCommand!), {
- kind: "upsertFile",
- path: "/opt/project/turbo.json",
- oldData: turboContent,
- newData,
- });
-
- deepStrictEqual(
- removeWhitespaces(abTestMiddlewareTsCommand!),
- removeWhitespaces({
- kind: "upsertFile",
- path: "/opt/project/abTestMiddleware.ts",
- oldData: abTestMiddlewareContent,
- newData: `import { type X } from 'y';
- const other = true;
-
- const ROUTES: [URLPattern, boolean][] = [
- [
- "/top-level/:path*",
- Boolean(process.env.APP_ROUTER_TOP_LEVEL_ENABLED)
- ] as const
- ].map(([pathname, enabled]) => [new URLPattern({
- pathname
- }), enabled]);`,
- }),
- );
- });
-});
diff --git a/packages/codemods/cal.com/generate-url-patterns/tsconfig.json b/packages/codemods/cal.com/generate-url-patterns/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/cal.com/generate-url-patterns/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/codemod-com/migrate-codemod-registry/.codemodrc.json b/packages/codemods/codemod-com/migrate-codemod-registry/.codemodrc.json
deleted file mode 100644
index b4dad2e15..000000000
--- a/packages/codemods/codemod-com/migrate-codemod-registry/.codemodrc.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.0",
- "name": "migrate-codemod-registry",
- "private": false,
- "engine": "filemod",
- "meta": {
- "tags": ["migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/codemod-com/migrate-codemod-registry"
- }
-}
diff --git a/packages/codemods/codemod-com/migrate-codemod-registry/README.md b/packages/codemods/codemod-com/migrate-codemod-registry/README.md
deleted file mode 100644
index e69de29bb..000000000
diff --git a/packages/codemods/codemod-com/migrate-codemod-registry/package.json b/packages/codemods/codemod-com/migrate-codemod-registry/package.json
deleted file mode 100644
index a974cf1e1..000000000
--- a/packages/codemods/codemod-com/migrate-codemod-registry/package.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name": "@codemod-com/codemod-migrate-codemod-registry",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "@codemod-com/filemod": "workspace:*",
- "memfs": "^4.6.0",
- "ts-morph": "^19.0.0",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {},
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/codemod-com/migrate-codemod-registry/src/index.ts b/packages/codemods/codemod-com/migrate-codemod-registry/src/index.ts
deleted file mode 100644
index 9e293f79a..000000000
--- a/packages/codemods/codemod-com/migrate-codemod-registry/src/index.ts
+++ /dev/null
@@ -1,512 +0,0 @@
-import { format, parse, sep } from "node:path";
-import type {
- Filemod,
- HandleData,
- HandleFile,
- HandleFinish,
- InitializeState,
-} from "@codemod-com/filemod";
-import type jscodeshift from "jscodeshift";
-
-type Dependencies = {
- jscodeshift: typeof jscodeshift;
-};
-type State = {
- step: "UPSERTING_CODEMODS" | "UPSERTING_WORKSPACES";
- workspaces: Set;
-};
-
-const isNeitherNullNorUndefined = (
- t: NonNullable | null | undefined,
-): t is NonNullable => t !== null && t !== undefined;
-
-const initializeState: InitializeState = async (_, state) => {
- if (state === null) {
- return {
- step: "UPSERTING_CODEMODS",
- workspaces: new Set(),
- };
- }
-
- return {
- step: "UPSERTING_WORKSPACES",
- workspaces: state.workspaces,
- };
-};
-
-type FileCommand = Awaited>>[number];
-
-const handleFile: HandleFile = async (
- api,
- path,
- options,
- state,
-) => {
- const parsedCwd = parse(
- api.joinPaths(api.currentWorkingDirectory, "placeholder.txt"),
- );
- const parsedPath = parse(path);
-
- const cwdDirectoryNames = parsedCwd.dir.split(sep);
- const pathDirectoryNames = parsedPath.dir.split(sep);
-
- if (
- ["cjs-builder", "builder", "utilities", "tsconfig"].some((name) =>
- pathDirectoryNames.includes(name),
- )
- ) {
- return [];
- }
-
- if (![".ts", ".js", ".json", ".md", ".toml"].includes(parsedPath.ext)) {
- return [];
- }
-
- const directoryName = pathDirectoryNames
- .map((name, i) => (name !== cwdDirectoryNames[i] ? name : null))
- .filter(isNeitherNullNorUndefined);
-
- if (directoryName.length === 0) {
- if (parsedPath.base === "package.json") {
- return [
- {
- kind: "upsertFile",
- path: api.joinPaths(
- api.currentWorkingDirectory,
- "pnpm-workspace.yaml",
- ),
- options,
- },
- ];
- }
-
- return [];
- }
-
- const newPath = api.joinPaths(
- api.currentWorkingDirectory,
- "codemods",
- ...directoryName,
- parsedPath.name === "index"
- ? "src"
- : parsedPath.name === "test" && directoryName.at(-1) !== "test"
- ? "test"
- : "",
- parsedPath.base,
- );
-
- const data = await api.readFile(path);
-
- const commands: FileCommand[] = [
- {
- kind: "upsertFile",
- path: newPath,
- options: {
- ...options,
- data,
- },
- },
- ];
-
- if (parsedPath.base === ".codemodrc.json") {
- const parsedData = JSON.parse(data);
-
- const { engine } = parsedData;
-
- state?.workspaces.add(
- api.joinPaths("codemods", ...directoryName.slice(0, -1), "*"),
- );
-
- const indexTsPath = format({
- root: parsedPath.root,
- dir: parsedPath.dir,
- base: "index.ts",
- });
-
- const testTsPath = format({
- root: parsedPath.root,
- dir: parsedPath.dir,
- base: "test.ts",
- });
-
- const embeddedTestTsPath = format({
- root: parsedPath.root,
- dir: `${parsedPath.dir}/test`,
- base: "test.ts",
- });
-
- const indexTsDoesExist = api.exists(indexTsPath);
-
- const testTsDoesExist =
- api.exists(testTsPath) || api.exists(embeddedTestTsPath);
-
- {
- const packageJsonPath = api.joinPaths(
- api.currentWorkingDirectory,
- "codemods",
- ...directoryName,
- "package.json",
- );
-
- const name = `@codemod-com/registry/${directoryName
- .join("-")
- .toLowerCase()
- .replace(/ /, "-")}`;
-
- commands.push({
- kind: "upsertFile",
- path: packageJsonPath,
- options: {
- ...options,
- name,
- engine,
- extension: indexTsDoesExist ? "ts" : "js",
- testTsDoesExist,
- },
- });
- }
-
- const jsEngineUsed = engine !== "recipe" && engine !== "piranha";
-
- if (jsEngineUsed) {
- const tsconfigJsonPath = api.joinPaths(
- api.currentWorkingDirectory,
- "codemods",
- ...directoryName,
- "tsconfig.json",
- );
-
- commands.push({
- kind: "upsertFile",
- path: tsconfigJsonPath,
- options,
- });
- }
-
- if (jsEngineUsed) {
- const mocharcPath = api.joinPaths(
- api.currentWorkingDirectory,
- "codemods",
- ...directoryName,
- ".mocharc.json",
- );
-
- commands.push({
- kind: "upsertFile",
- path: mocharcPath,
- options: {
- ...options,
- },
- });
- }
-
- if (jsEngineUsed) {
- const indexDtsPath = api.joinPaths(
- api.currentWorkingDirectory,
- "codemods",
- ...directoryName,
- "index.d.ts",
- );
-
- commands.push({
- kind: "upsertFile",
- path: indexDtsPath,
- options: {
- ...options,
- engine,
- },
- });
- }
- }
-
- return commands;
-};
-
-const handleData: HandleData = async (
- api,
- path,
- __,
- options,
- state,
-) => {
- if (state === null) {
- throw new Error("The state is not set");
- }
-
- if (state.step === "UPSERTING_CODEMODS") {
- if (path.endsWith("package.json")) {
- const name = typeof options.name === "string" ? options.name : null;
-
- const engine = typeof options.engine === "string" ? options.engine : null;
-
- const extension =
- typeof options.extension === "string" ? options.extension : null;
-
- const testTsDoesExist =
- typeof options.testTsDoesExist === "boolean"
- ? options.testTsDoesExist
- : false;
-
- if (name === null || engine === null || extension === null) {
- throw new Error("Name and engine need to be defined for package.json");
- }
-
- const jsEngineUsed = engine !== "recipe" && engine !== "piranha";
-
- const dependencies: Record | undefined = jsEngineUsed
- ? {}
- : undefined;
-
- const devDependencies: Record | undefined = jsEngineUsed
- ? {
- "@codemod-com/tsconfig": "workspace:*",
- "@codemod-com/utilities": "workspace:*",
- typescript: "^5.2.2",
- esbuild: "0.19.5",
- mocha: "^10.2.0",
- "@types/mocha": "^10.0.4",
- "ts-node": "^10.9.1",
- }
- : undefined;
-
- if (devDependencies !== undefined && engine === "jscodeshift") {
- devDependencies.jscodeshift = "^0.15.1";
- devDependencies["@types/jscodeshift"] = "^0.11.10";
- } else if (devDependencies !== undefined && engine === "ts-morph") {
- devDependencies["ts-morph"] = "^19.0.0";
- } else if (devDependencies !== undefined && engine === "filemod") {
- devDependencies["@codemod-com/filemod"] = "1.1.0";
- // this might be required sometimes
- devDependencies.memfs = "^4.6.0";
- devDependencies["ts-morph"] = "^19.0.0";
- devDependencies.jscodeshift = !path.includes("remove-get-static-props")
- ? "^0.15.1"
- : "0.14.0";
- devDependencies["@types/jscodeshift"] = "^0.11.10";
- }
-
- if (dependencies && path.includes("ember/5/no-implicit-this")) {
- dependencies["ember-codemods-telemetry-helpers"] = "^3.0.0";
- dependencies["ember-template-recast"] = "^6.1.4";
- dependencies.debug = "^4.3.4";
- }
-
- if (dependencies && path.includes("next/13/move-css-in-js-styles")) {
- dependencies.sinon = "^15.0.1";
- }
-
- if (
- dependencies &&
- (path.includes("app-directory-boilerplate") ||
- path.includes("replace-next-head"))
- ) {
- dependencies["mdast-util-from-markdown"] = "^2.0.0";
- dependencies["mdast-util-to-markdown"] = "^2.1.0";
- dependencies["micromark-extension-mdxjs"] = "^2.0.0";
- dependencies["mdast-util-mdx"] = "^3.0.0";
- dependencies["unist-util-visit"] = "^5.0.0";
- }
-
- if (dependencies && path.includes("replace-next-head")) {
- dependencies["unist-util-filter"] = "^5.0.1";
- }
-
- const main = jsEngineUsed ? "./dist/index.cjs" : undefined;
- const types = jsEngineUsed ? "/dist/index.d.ts" : undefined;
-
- const scripts: Record | undefined = jsEngineUsed
- ? {
- "build:cjs": `cjs-builder ./src/index.${extension}`,
- }
- : undefined;
-
- if (scripts !== undefined && testTsDoesExist) {
- scripts.test = "mocha";
- }
-
- const files: string[] = ["README.md", ".codemodrc.json"];
-
- if (jsEngineUsed) {
- files.push("./dist/index.cjs", "./index.d.ts");
- }
-
- const data = JSON.stringify({
- name,
- dependencies,
- devDependencies,
- main,
- types,
- scripts,
- files,
- type: "module",
- });
-
- return {
- kind: "upsertData",
- path,
- data,
- };
- }
-
- if (path.endsWith("index.d.ts")) {
- const engine = typeof options.engine === "string" ? options.engine : null;
-
- if (engine === null) {
- throw new Error("Name and engine need to be defined for package.json");
- }
-
- const data =
- engine === "jscodeshift"
- ? [
- "import type { API, FileInfo } from 'jscodeshift';",
- "export default function transform(file: FileInfo, api: API): string;",
- ].join("\n")
- : engine === "ts-morph"
- ? [
- "import type { SourceFile } from 'ts-morph';",
- "export function handleSourceFile(sourceFile: SourceFile): string | undefined;",
- ].join("\n")
- : engine === "filemod"
- ? [
- "import type { Filemod } from '@codemod-com/filemod';",
- "export const repomod: Filemod<{}, {}>;",
- ].join("\n")
- : "";
-
- return {
- kind: "upsertData",
- path,
- data,
- };
- }
-
- if (path.endsWith(".mocharc.json")) {
- const data = JSON.stringify({
- loader: ["ts-node/esm"],
- "full-trace": true,
- failZero: false,
- bail: true,
- spec: "./**/test.ts",
- timeout: 5000,
- });
-
- return {
- kind: "upsertData",
- path,
- data,
- };
- }
-
- if (path.endsWith("tsconfig.json")) {
- const data = JSON.stringify({
- extends: "@codemod-com/tsconfig",
- include: [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js",
- ],
- });
-
- return {
- kind: "upsertData",
- path,
- data,
- };
- }
-
- if (path.endsWith("test.ts")) {
- const data = typeof options.data === "string" ? options.data : null;
-
- if (data === null) {
- throw new Error("Data must be present for test.ts files");
- }
-
- const { jscodeshift: j } = api.getDependencies();
-
- const root = j.withParser("tsx")(data);
-
- // adapted from codemod.com/studio AI
- let dirtyFlag = false;
-
- root.find(j.ImportDeclaration).forEach((path) => {
- if (path.node.type === "ImportDeclaration") {
- if (path.node.source.value === "./index.js") {
- path.node.source.value = "../src/index.js";
- dirtyFlag = true;
- }
-
- if (path.node.source.value === "../index.js") {
- path.node.source.value = "../src/index.js";
- dirtyFlag = true;
- }
-
- if (path.node.source.value?.toString().endsWith("../utilities.js")) {
- path.node.source.value = "@codemod-com/utilities";
- dirtyFlag = true;
- }
- }
- });
-
- return {
- kind: "upsertData",
- path,
- data: dirtyFlag ? root.toSource() : data,
- };
- }
-
- if (typeof options.data === "string") {
- return {
- kind: "upsertData",
- path,
- data: options.data,
- };
- }
-
- return { kind: "noop" };
- }
-
- if (
- state.step === "UPSERTING_WORKSPACES" &&
- path.endsWith("pnpm-workspace.yaml")
- ) {
- const workspaces = Array.from(state.workspaces).sort();
- workspaces.unshift("builder");
- workspaces.unshift("utilities");
- workspaces.unshift("tsconfig");
- workspaces.unshift("cjs-builder");
-
- const data = [
- "packages:",
- ...workspaces.map((workspace) => ` - './${workspace}'`),
- "",
- ].join("\n");
-
- return {
- kind: "upsertData",
- path,
- data,
- };
- }
-
- return { kind: "noop" };
-};
-
-const handleFinish: HandleFinish = async (_, state) => {
- if (state === null) {
- throw new Error("The state is not set");
- }
-
- return {
- kind: state.step === "UPSERTING_CODEMODS" ? "restart" : "noop",
- };
-};
-
-export const repomod: Filemod = {
- includePatterns: ["**/**/*.{js,ts,json,md,toml}"],
- excludePatterns: ["**/node_modules/**", "**/build/**", "**/codemods/**"],
- initializeState,
- handleFile,
- handleData,
- handleFinish,
-};
diff --git a/packages/codemods/codemod-com/migrate-codemod-registry/tsconfig.json b/packages/codemods/codemod-com/migrate-codemod-registry/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/codemod-com/migrate-codemod-registry/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/codemod-com/update-git-urls/.codemodrc.json b/packages/codemods/codemod-com/update-git-urls/.codemodrc.json
deleted file mode 100644
index d87acddae..000000000
--- a/packages/codemods/codemod-com/update-git-urls/.codemodrc.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "version": "1.0.0",
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "name": "codemod-com/update-git-urls",
- "private": false,
- "engine": "filemod",
- "applicability": {},
- "meta": {
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/codemod-com/update-git-urls",
- "tags": ["migration", "prisma"]
- }
-}
diff --git a/packages/codemods/codemod-com/update-git-urls/README.md b/packages/codemods/codemod-com/update-git-urls/README.md
deleted file mode 100644
index 516b5948f..000000000
--- a/packages/codemods/codemod-com/update-git-urls/README.md
+++ /dev/null
@@ -1 +0,0 @@
-This codemod backfills git urls for all of the Codemod.com codemods.
\ No newline at end of file
diff --git a/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture1.input.json b/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture1.input.json
deleted file mode 100644
index 2e66f3ba5..000000000
--- a/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture1.input.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "myname",
- "meta": {}
-}
\ No newline at end of file
diff --git a/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture1.output.json b/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture1.output.json
deleted file mode 100644
index 2978babb6..000000000
--- a/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture1.output.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "myname",
- "meta": {
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/codemod-com/update-git-urls/__testfixtures__"
- }
-}
\ No newline at end of file
diff --git a/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture2.input.json b/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture2.input.json
deleted file mode 100644
index e15476d96..000000000
--- a/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture2.input.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "name": "myname"
-}
\ No newline at end of file
diff --git a/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture2.output.json b/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture2.output.json
deleted file mode 100644
index 2978babb6..000000000
--- a/packages/codemods/codemod-com/update-git-urls/__testfixtures__/fixture2.output.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "myname",
- "meta": {
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/codemod-com/update-git-urls/__testfixtures__"
- }
-}
\ No newline at end of file
diff --git a/packages/codemods/codemod-com/update-git-urls/package.json b/packages/codemods/codemod-com/update-git-urls/package.json
deleted file mode 100644
index c4e50db33..000000000
--- a/packages/codemods/codemod-com/update-git-urls/package.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name": "@codemod-com/codemod-update-git-urls",
- "devDependencies": {
- "@codemod-com/filemod": "workspace:*",
- "@vitest/coverage-v8": "catalog:",
- "jscodeshift": "^0.15.1",
- "memfs": "^4.6.0",
- "ts-node": "^10.9.1",
- "typescript": "^5.2.2",
- "vitest": "^1.0.1"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/codemod-com/update-git-urls/src/index.ts b/packages/codemods/codemod-com/update-git-urls/src/index.ts
deleted file mode 100644
index 5032714f9..000000000
--- a/packages/codemods/codemod-com/update-git-urls/src/index.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { dirname } from "node:path";
-import type { Filemod } from "@codemod-com/filemod";
-
-export const repomod: Filemod, Record> = {
- includePatterns: ["**/.codemodrc.json"],
- excludePatterns: ["**/node_modules/**"],
- handleFile: async (_api, path, options, state) => {
- return [{ kind: "upsertFile", path, options, state }];
- },
- handleData: async (_api, path, data) => {
- let codemodRc: { meta?: { git?: string } };
- try {
- codemodRc = JSON.parse(data);
- } catch (err) {
- return { kind: "noop" };
- }
-
- if (codemodRc.meta?.git) {
- return { kind: "noop" };
- }
-
- const rcFilePath = path.split("packages/codemods/").at(-1);
- if (typeof rcFilePath !== "string") {
- return { kind: "noop" };
- }
-
- codemodRc.meta = {
- ...(codemodRc.meta ?? {}),
- git: `https://github.com/codemod-com/codemod/tree/main/packages/codemods/${dirname(rcFilePath)}`,
- };
-
- return {
- kind: "upsertData",
- path,
- data: JSON.stringify(codemodRc, null, 2),
- };
- },
-};
diff --git a/packages/codemods/codemod-com/update-git-urls/test/test.ts b/packages/codemods/codemod-com/update-git-urls/test/test.ts
deleted file mode 100644
index cf9d2e34e..000000000
--- a/packages/codemods/codemod-com/update-git-urls/test/test.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { deepEqual, ok } from "node:assert";
-import { readFile } from "node:fs/promises";
-import { join } from "node:path";
-import type { DirectoryJSON } from "memfs";
-import { Volume, createFsFromVolume } from "memfs";
-
-import { buildApi, executeFilemod } from "@codemod-com/filemod";
-import { buildPathAPI, buildUnifiedFileSystem } from "@codemod-com/utilities";
-import { describe, it } from "vitest";
-import { repomod } from "../src/index.js";
-
-const transform = async (json: DirectoryJSON) => {
- const volume = Volume.fromJSON(json);
-
- const fs = createFsFromVolume(volume);
-
- const unifiedFileSystem = buildUnifiedFileSystem(fs);
- const pathApi = buildPathAPI("/");
-
- const api = buildApi(unifiedFileSystem, () => ({}), pathApi);
-
- return executeFilemod(api, repomod, "/", {}, {}, null);
-};
-
-describe("fill git urls codemod tests", async () => {
- it("should correctly modify example in fixture #1", async () => {
- const examplePath =
- "/Users/codemod/projects/codemod/packages/codemods/codemod-com/update-git-urls/__testfixtures__/.codemodrc.json";
-
- const example1Content = await readFile(
- join(__dirname, "..", "__testfixtures__", "fixture1.input.json"),
- "utf-8",
- );
-
- const externalFileCommands = await transform({
- [examplePath]: example1Content,
- });
-
- const example1Command = externalFileCommands.find(
- (command) =>
- command.kind === "upsertFile" && command.path === examplePath,
- );
-
- ok(example1Command);
- ok(example1Command.kind === "upsertFile");
- const example1Fixture = await readFile(
- join(__dirname, "..", "__testfixtures__", "fixture1.output.json"),
- "utf-8",
- );
- deepEqual(example1Command.newData, example1Fixture);
- });
-
- it("should correctly modify example in fixture #2", async () => {
- const examplePath =
- "/Users/codemod/projects/codemod/packages/codemods/codemod-com/update-git-urls/__testfixtures__/.codemodrc.json";
-
- const example2Content = await readFile(
- join(__dirname, "..", "__testfixtures__", "fixture2.input.json"),
- "utf-8",
- );
-
- const externalFileCommands = await transform({
- [examplePath]: example2Content,
- });
-
- const example2Command = externalFileCommands.find(
- (command) =>
- command.kind === "upsertFile" && command.path === examplePath,
- );
-
- ok(example2Command);
- ok(example2Command.kind === "upsertFile");
- const example2Fixture = await readFile(
- join(__dirname, "..", "__testfixtures__", "fixture2.output.json"),
- "utf-8",
- );
- deepEqual(example2Command.newData, example2Fixture);
- });
-});
diff --git a/packages/codemods/codemod-com/update-git-urls/tsconfig.json b/packages/codemods/codemod-com/update-git-urls/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/codemod-com/update-git-urls/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/.codemodrc.json b/packages/codemods/devcycle/launchdarkly-to-devcycle/.codemodrc.json
deleted file mode 100644
index e8e888358..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/.codemodrc.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "name": "devcycle/launchdarkly-to-devcycle",
- "version": "1.0.1",
- "engine": "jscodeshift",
- "private": false,
- "arguments": [],
- "meta": {
- "tags": ["devcycle", "migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/devcycle/launchdarkly-to-devcycle"
- },
- "deps": [
- "@devcycle/react-client-sdk@latest",
- "-launchdarkly-react-client-sdk"
- ]
-}
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/.gitignore b/packages/codemods/devcycle/launchdarkly-to-devcycle/.gitignore
deleted file mode 100644
index 76add878f..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules
-dist
\ No newline at end of file
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/LICENSE b/packages/codemods/devcycle/launchdarkly-to-devcycle/LICENSE
deleted file mode 100644
index 72d1e15d9..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2024 dmytrohryshyn
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/README.md b/packages/codemods/devcycle/launchdarkly-to-devcycle/README.md
deleted file mode 100644
index 3fcc6afe4..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/README.md
+++ /dev/null
@@ -1,28 +0,0 @@
-This codemod migrates project from Launchdarkly React SDK to DevCycle React SDK
-
-## Example
-
-### Before
-
-```ts
-import { withLDProvider } from 'launchdarkly-react-client-sdk';
-
-const App = () => null;
-
-export default withLDProvider({
- clientSideID: '',
-})(App);
-```
-
-### After
-
-```ts
-import { withDevCycleProvider } from "@devcycle/react-client-sdk";
-
-const App = () => null;
-
-export default withDevCycleProvider({
- sdkKey: ''
-})(App);
-```
-
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/useFlags.input.ts b/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/useFlags.input.ts
deleted file mode 100644
index 49400d48f..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/useFlags.input.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { useFlags } from 'launchdarkly-react-client-sdk';
-
-const App = () => {
- const { flag } = useFlags();
-
- return <>{flag}>
-};
\ No newline at end of file
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/useFlags.output.ts b/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/useFlags.output.ts
deleted file mode 100644
index 611a8fe72..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/useFlags.output.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { useDevCycleClient } from "@devcycle/react-client-sdk";
-
-const App = () => {
- const { flag } = useDevCycleClient().allVariables();
-
- return <>{flag.value}>;
-};
\ No newline at end of file
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/withLDProvider.input.ts b/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/withLDProvider.input.ts
deleted file mode 100644
index 03fa9e9a1..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/withLDProvider.input.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { withLDProvider } from 'launchdarkly-react-client-sdk';
-
-const App = () => null;
-
-export default withLDProvider({
- clientSideID: '',
-})(App);
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/withLDProvider.output.ts b/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/withLDProvider.output.ts
deleted file mode 100644
index 0a6a8ea06..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/__testfixtures__/withLDProvider.output.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { withDevCycleProvider } from "@devcycle/react-client-sdk";
-
-const App = () => null;
-
-export default withDevCycleProvider({
- sdkKey: ''
-})(App);
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/package.json b/packages/codemods/devcycle/launchdarkly-to-devcycle/package.json
deleted file mode 100644
index 297efc17e..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/package.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "launchdarkly-to-devcycle",
- "author": "dmytrohryshyn",
- "private": true,
- "dependencies": {},
- "devDependencies": {
- "@types/node": "20.9.0",
- "typescript": "5.2.2",
- "vitest": "^1.0.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10"
- },
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch"
- },
- "license": "MIT",
- "files": ["README.md", ".codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/src/index.ts b/packages/codemods/devcycle/launchdarkly-to-devcycle/src/index.ts
deleted file mode 100644
index 2d83ceb27..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/src/index.ts
+++ /dev/null
@@ -1,289 +0,0 @@
-import type {
- API,
- ASTPath,
- CallExpression,
- Collection,
- FileInfo,
- Identifier,
- JSCodeshift,
- ObjectExpression,
- Options,
-} from "jscodeshift";
-
-/**
- * Utils
- */
-const collectImportNames = (
- j: JSCodeshift,
- root: Collection,
- source: string,
-) => {
- const importSpecifierLocalNames = new Map();
-
- let importDefaultSpecifierName: string | null = null;
- let importNamespaceSpecifierName: string | null = null;
-
- root
- .find(j.ImportDeclaration, {
- source: { value: source },
- })
- .forEach((path) => {
- path.value.specifiers?.forEach((specifier) => {
- if (j.ImportSpecifier.check(specifier)) {
- importSpecifierLocalNames.set(
- specifier.imported.name,
- specifier.local?.name ?? "",
- );
- }
-
- if (j.ImportDefaultSpecifier.check(specifier) && specifier.local) {
- importDefaultSpecifierName = specifier.local.name;
- }
-
- if (j.ImportNamespaceSpecifier.check(specifier) && specifier.local) {
- importNamespaceSpecifierName = specifier.local.name;
- }
- });
- });
-
- return {
- importSpecifierLocalNames,
- importDefaultSpecifierName,
- importNamespaceSpecifierName,
- };
-};
-
-const getLibraryMethodCallMatcher =
- (
- j: JSCodeshift,
- importSpecifiersLocalNames: string[],
- importedModuleName: string,
- ) =>
- (path: ASTPath) => {
- const { callee } = path.value;
-
- if (
- j.Identifier.check(callee) &&
- importSpecifiersLocalNames.includes(callee.name)
- ) {
- return callee.name;
- }
-
- if (
- j.MemberExpression.check(callee) &&
- j.Identifier.check(callee.object) &&
- callee.object.name === importedModuleName &&
- j.Identifier.check(callee.property)
- ) {
- return callee.property.name;
- }
-
- return null;
- };
-
-const getImportDeclaration = (
- j: JSCodeshift,
- root: Collection,
- importName: string,
-) =>
- root
- .find(j.ImportDeclaration, {
- source: { value: importName },
- })
- .paths()
- .at(0)?.node;
-
-const buildImportDeclaration = (j: JSCodeshift, sourceName: string) => {
- return j.importDeclaration([], j.literal(sourceName));
-};
-
-const addNamedImport = (
- j: JSCodeshift,
- root: Collection,
- importName: string,
- sourceName: string,
-) => {
- const existingImportDeclaration = getImportDeclaration(j, root, sourceName);
- const importDeclaration =
- existingImportDeclaration ?? buildImportDeclaration(j, sourceName);
-
- const importSpecifier = j.importSpecifier(j.identifier(importName));
-
- if (
- importDeclaration.specifiers?.findIndex(
- (s) =>
- importSpecifier.imported &&
- s.local?.name === importSpecifier.imported.name,
- ) === -1
- ) {
- importDeclaration.specifiers?.push(importSpecifier);
- }
-
- if (!existingImportDeclaration) {
- const body = root.get().node.program.body;
- body.unshift(importDeclaration);
- }
-};
-
-/**
- * Replacement functions
- */
-
-const LDToDevCycleConfigPropsMap: Record = {
- clientSideID: "sdkKey",
-};
-
-const buildDVCConfig = (j: JSCodeshift, node: ObjectExpression) => {
- const newProperties = node.properties
- .map((p) => {
- if (
- !j.ObjectProperty.check(p) ||
- !j.Identifier.check(p.key) ||
- !LDToDevCycleConfigPropsMap[p.key.name]
- ) {
- return;
- }
-
- return j.objectProperty(
- j.identifier(LDToDevCycleConfigPropsMap[p.key.name]),
- p.value,
- );
- })
- .filter(Boolean);
-
- return j.objectExpression(newProperties);
-};
-
-const replaceWithLDProvider = (
- j: JSCodeshift,
- root: Collection,
- path: ASTPath,
-) => {
- const config = path.node.arguments.at(0);
-
- if (!j.ObjectExpression.check(config)) {
- return;
- }
-
- const newConfig = buildDVCConfig(j, config);
-
- const newCE = j.callExpression(j.identifier("withDevCycleProvider"), [
- newConfig,
- ]);
-
- path.replace(newCE);
-
- addNamedImport(j, root, "withDevCycleProvider", "@devcycle/react-client-sdk");
-};
-
-const replaceUseFlags = (
- j: JSCodeshift,
- root: Collection,
- path: ASTPath,
-) => {
- const allVariables = j.memberExpression(
- j.callExpression(j.identifier("useDevCycleClient"), []),
- j.callExpression(j.identifier("allVariables"), []),
- );
-
- const parent = path.parent.node;
- let variable: Identifier | null = null;
-
- // check variables
- if (j.VariableDeclarator.check(parent)) {
- const id = parent.id;
-
- if (j.ObjectPattern.check(id)) {
- const firstProp = id.properties.at(0);
-
- if (
- j.ObjectProperty.check(firstProp) &&
- j.Identifier.check(firstProp.value)
- ) {
- variable = firstProp.value;
- }
- }
- }
-
- if (variable !== null) {
- root
- .find(j.Identifier, {
- name: variable.name,
- })
- .forEach((path) => {
- if (
- path.node.start === variable.start &&
- path.node.end === variable.end
- ) {
- return;
- }
-
- path.replace(j.memberExpression(path.node, j.identifier("value")));
- });
- }
-
- path.replace(allVariables);
- addNamedImport(j, root, "useDevCycleClient", "@devcycle/react-client-sdk");
-};
-
-const replacementFunctions: Record<
- string,
- (j: JSCodeshift, root: Collection, path: ASTPath) => void
-> = {
- withLDProvider: replaceWithLDProvider,
- useFlags: replaceUseFlags,
-};
-
-export default function transform(
- file: FileInfo,
- api: API,
- options?: Options,
-): string | undefined {
- const j = api.jscodeshift;
- const root = j(file.source);
-
- let isDirty = false;
-
- const {
- importNamespaceSpecifierName,
- importDefaultSpecifierName,
- importSpecifierLocalNames,
- } = collectImportNames(j, root, "launchdarkly-react-client-sdk");
-
- const importedModuleName =
- importDefaultSpecifierName ?? importNamespaceSpecifierName ?? "";
-
- const matchMethod = getLibraryMethodCallMatcher(
- j,
- [...importSpecifierLocalNames.values()],
- importedModuleName,
- );
-
- root.find(j.CallExpression).forEach((path) => {
- const match = matchMethod(path);
-
- if (match === null) {
- return;
- }
-
- const replacementFunction = replacementFunctions[match];
-
- if (replacementFunction) {
- replacementFunction(j, root, path);
- isDirty = true;
- }
- });
-
- if (isDirty) {
- // @TODO check if not used
- root
- .find(j.ImportDeclaration, {
- source: {
- value: "launchdarkly-react-client-sdk",
- },
- })
- .remove();
- }
-
- return isDirty ? root.toSource() : undefined;
-}
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/test/test.ts b/packages/codemods/devcycle/launchdarkly-to-devcycle/test/test.ts
deleted file mode 100644
index 3ceac2382..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/test/test.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import assert from "node:assert";
-import { readFile } from "node:fs/promises";
-import { join } from "node:path";
-import jscodeshift, { type API } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-const buildApi = (parser: string | undefined): API => ({
- j: parser ? jscodeshift.withParser(parser) : jscodeshift,
- jscodeshift: parser ? jscodeshift.withParser(parser) : jscodeshift,
- stats: () => {
- console.error(
- "The stats function was called, which is not supported on purpose",
- );
- },
- report: () => {
- console.error(
- "The report function was called, which is not supported on purpose",
- );
- },
-});
-
-describe("launchdarkly-to-devcycle", () => {
- it("Should replace withLDProvider HOC", async () => {
- const INPUT = await readFile(
- join(__dirname, "..", "__testfixtures__/withLDProvider.input.ts"),
- "utf-8",
- );
- const OUTPUT = await readFile(
- join(__dirname, "..", "__testfixtures__/withLDProvider.output.ts"),
- "utf-8",
- );
-
- const actualOutput = transform(
- {
- path: "index.js",
- source: INPUT,
- },
- buildApi("tsx"),
- );
-
- assert.deepEqual(
- actualOutput?.replace(/W/gm, ""),
- OUTPUT.replace(/W/gm, ""),
- );
- });
-
- it("Should replace useFlags hook", async () => {
- const INPUT = await readFile(
- join(__dirname, "..", "__testfixtures__/useFlags.input.ts"),
- "utf-8",
- );
- const OUTPUT = await readFile(
- join(__dirname, "..", "__testfixtures__/useFlags.output.ts"),
- "utf-8",
- );
-
- const actualOutput = transform(
- {
- path: "index.js",
- source: INPUT,
- },
- buildApi("tsx"),
- );
-
- assert.deepEqual(
- actualOutput?.replace(/W/gm, ""),
- OUTPUT.replace(/W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/tsconfig.json b/packages/codemods/devcycle/launchdarkly-to-devcycle/tsconfig.json
deleted file mode 100644
index 329a7d63f..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/tsconfig.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "compilerOptions": {
- "baseUrl": ".",
- "outDir": "./dist"
- },
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ],
- "exclude": ["node_modules", "./dist/**/*"],
- "ts-node": {
- "transpileOnly": true
- }
-}
diff --git a/packages/codemods/devcycle/launchdarkly-to-devcycle/vitest.config.ts b/packages/codemods/devcycle/launchdarkly-to-devcycle/vitest.config.ts
deleted file mode 100644
index 772ad4c3b..000000000
--- a/packages/codemods/devcycle/launchdarkly-to-devcycle/vitest.config.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { configDefaults, defineConfig } from "vitest/config";
-
-export default defineConfig({
- test: {
- include: [...configDefaults.include, "**/test/*.ts"],
- },
-});
diff --git a/packages/codemods/devcycle/replace-feature-flag/.codemodrc.json b/packages/codemods/devcycle/replace-feature-flag/.codemodrc.json
deleted file mode 100644
index 65773b8c2..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/.codemodrc.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.2",
- "private": false,
- "name": "devcycle/replace-feature-flag",
- "engine": "ts-morph",
- "meta": {
- "tags": ["devcycle", "feature-flag"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/devcycle/replace-feature-flag"
- },
- "arguments": [
- {
- "name": "type",
- "kind": "enum",
- "options": ["boolean", "string", "number", "JSON"],
- "required": true
- },
- {
- "name": "value",
- "kind": "string",
- "required": true
- },
- {
- "name": "key",
- "kind": "string",
- "required": true
- }
- ]
-}
diff --git a/packages/codemods/devcycle/replace-feature-flag/.gitignore b/packages/codemods/devcycle/replace-feature-flag/.gitignore
deleted file mode 100644
index 76add878f..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules
-dist
\ No newline at end of file
diff --git a/packages/codemods/devcycle/replace-feature-flag/LICENSE b/packages/codemods/devcycle/replace-feature-flag/LICENSE
deleted file mode 100644
index 72d1e15d9..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2024 dmytrohryshyn
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/packages/codemods/devcycle/replace-feature-flag/README.md b/packages/codemods/devcycle/replace-feature-flag/README.md
deleted file mode 100644
index e6d3001fb..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/README.md
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-This codemod replaces DevCycle feature flags with a static value provided by the user.
-It replaces following SDK method calls: `variable`, `variableValue`, `useVariable`, `useDVCVariable`, `useVariableValue`.
-
-The codemod accepts the following arguments:
-
-- `key`: The key of the feature flag to be replaced.
-- `value`: The value to replace the feature flag with.
-- `type`: The type to which the provided value should be cast.
-
-## Example
-
-### Before
-
-```ts
-const simpleCaseValue = dvcClient.variable(user, "simple-case", true).value
-const simpleCase = dvcClient.variable(user, "simple-case", true)
-const isDefaulted = dvcClient.variable(user, "simple-case", true).isDefaulted
-
-console.log('isDefaulted: ' + isDefaulted)
-console.log(dvcClient.variable(user, "simple-case", true))
-
-if (simpleCaseValue === true) {
- const someVar = dvcClient.variable(user, "some-var", "stringy")
- const templateVar = `Hello, ${someVar}`
- const concatVar = "Goodbye, " + someVar
-}
-
-if (simpleCase.value) {
- // Simple Case is true
- console.log('obj var .value is truthy')
-}
-
-if (simpleCaseValue === 3) {
- console.log('value var === 3')
-}
-
-const x = simpleCaseValue ? 1 : 0
-
-if (dvcClient.variable(user, "simple-case", true).value === true) {
- console.log('obj.value === true')
-}
-
-if (dvcClient.variable(user, "simple-case", true).value) {
- console.log('obj.value is truthy')
-}
-
-console.log(dvcClient.variable(user, SIMPLE_CASE, true).value)
-
-console.log(useVariableValue("simple-case", true))
-
-function hello() {
- console.log("HELLO")
- dvcClient.variable(user, "simple-case", true).onUpdate((value) => {
- heroText.innerHTML = value
- })
-}
-```
-
-### After
-
-```ts
-console.log('isDefaulted: ' + true)
-console.log({
- key: "simple-case",
- value: true,
- defaultValue: true,
- isDefaulted: true
-})
-
-const someVar = dvcClient.variable(user, "some-var", "stringy")
-const templateVar = `Hello, ${someVar}`
-const concatVar = "Goodbye, " + someVar
-// Simple Case is true
-console.log('obj var .value is truthy')
-
-const x = 1
-
-console.log('obj.value === true')
-console.log('obj.value is truthy')
-
-console.log(dvcClient.variable(user, SIMPLE_CASE, true).value)
-
-console.log(true)
-
-function hello() {
- console.log("HELLO")
-}
-
-```
-
diff --git a/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/devcycle.input.js b/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/devcycle.input.js
deleted file mode 100644
index 417c0714d..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/devcycle.input.js
+++ /dev/null
@@ -1,42 +0,0 @@
-const simpleCaseValue = dvcClient.variable(user, "simple-case", true).value
-const simpleCase = dvcClient.variable(user, "simple-case", true)
-const isDefaulted = dvcClient.variable(user, "simple-case", true).isDefaulted
-
-console.log('isDefaulted: ' + isDefaulted)
-console.log(dvcClient.variable(user, "simple-case", true))
-
-if (simpleCaseValue === true) {
- const someVar = dvcClient.variable(user, "some-var", "stringy")
- const templateVar = `Hello, ${someVar}`
- const concatVar = "Goodbye, " + someVar
-}
-
-if (simpleCase.value) {
- // Simple Case is true
- console.log('obj var .value is truthy')
-}
-
-if (simpleCaseValue === 3) {
- console.log('value var === 3')
-}
-
-const x = simpleCaseValue ? 1 : 0
-
-if (dvcClient.variable(user, "simple-case", true).value === true) {
- console.log('obj.value === true')
-}
-
-if (dvcClient.variable(user, "simple-case", true).value) {
- console.log('obj.value is truthy')
-}
-
-console.log(dvcClient.variable(user, SIMPLE_CASE, true).value)
-
-console.log(useVariableValue("simple-case", true))
-
-function hello() {
- console.log("HELLO")
- dvcClient.variable(user, "simple-case", true).onUpdate((value) => {
- heroText.innerHTML = value
- })
-}
\ No newline at end of file
diff --git a/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/devcycle.output.js b/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/devcycle.output.js
deleted file mode 100644
index 93954787d..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/devcycle.output.js
+++ /dev/null
@@ -1,26 +0,0 @@
-console.log('isDefaulted: ' + true)
-console.log({
- key: "simple-case",
- value: true,
- defaultValue: true,
- isDefaulted: true
-})
-
-const someVar = dvcClient.variable(user, "some-var", "stringy")
-const templateVar = `Hello, ${someVar}`
-const concatVar = "Goodbye, " + someVar
-// Simple Case is true
-console.log('obj var .value is truthy')
-
-const x = 1
-
-console.log('obj.value === true')
-console.log('obj.value is truthy')
-
-console.log(dvcClient.variable(user, SIMPLE_CASE, true).value)
-
-console.log(true)
-
-function hello() {
- console.log("HELLO")
-}
diff --git a/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/object.input.js b/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/object.input.js
deleted file mode 100644
index 417c0714d..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/object.input.js
+++ /dev/null
@@ -1,42 +0,0 @@
-const simpleCaseValue = dvcClient.variable(user, "simple-case", true).value
-const simpleCase = dvcClient.variable(user, "simple-case", true)
-const isDefaulted = dvcClient.variable(user, "simple-case", true).isDefaulted
-
-console.log('isDefaulted: ' + isDefaulted)
-console.log(dvcClient.variable(user, "simple-case", true))
-
-if (simpleCaseValue === true) {
- const someVar = dvcClient.variable(user, "some-var", "stringy")
- const templateVar = `Hello, ${someVar}`
- const concatVar = "Goodbye, " + someVar
-}
-
-if (simpleCase.value) {
- // Simple Case is true
- console.log('obj var .value is truthy')
-}
-
-if (simpleCaseValue === 3) {
- console.log('value var === 3')
-}
-
-const x = simpleCaseValue ? 1 : 0
-
-if (dvcClient.variable(user, "simple-case", true).value === true) {
- console.log('obj.value === true')
-}
-
-if (dvcClient.variable(user, "simple-case", true).value) {
- console.log('obj.value is truthy')
-}
-
-console.log(dvcClient.variable(user, SIMPLE_CASE, true).value)
-
-console.log(useVariableValue("simple-case", true))
-
-function hello() {
- console.log("HELLO")
- dvcClient.variable(user, "simple-case", true).onUpdate((value) => {
- heroText.innerHTML = value
- })
-}
\ No newline at end of file
diff --git a/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/object.output.js b/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/object.output.js
deleted file mode 100644
index 77a459a60..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/__testfixtures__/object.output.js
+++ /dev/null
@@ -1,40 +0,0 @@
-console.log('isDefaulted: ' + true)
-console.log({
- key: "simple-case",
- value: {
- foo: {
- bar: null,
- baz: "str",
- faz: 12
- }
- },
- defaultValue: {
- foo: {
- bar: null,
- baz: "str",
- faz: 12
- }
- },
- isDefaulted: true
-})
-
-// Simple Case is true
-console.log('obj var .value is truthy')
-
-const x = 1
-
-console.log('obj.value is truthy')
-
-console.log(dvcClient.variable(user, SIMPLE_CASE, true).value)
-
-console.log({
- foo: {
- bar: null,
- baz: "str",
- faz: 12
- }
-})
-
-function hello() {
- console.log("HELLO")
-}
\ No newline at end of file
diff --git a/packages/codemods/devcycle/replace-feature-flag/package.json b/packages/codemods/devcycle/replace-feature-flag/package.json
deleted file mode 100644
index 7df8d08a5..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/package.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "devcycle/replace-feature-flag",
- "author": "dmytrohryshyn",
- "private": true,
- "dependencies": {},
- "devDependencies": {
- "@types/node": "20.9.0",
- "typescript": "5.2.2",
- "vitest": "^1.0.1",
- "ts-morph": "^22.0.0"
- },
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch"
- },
- "license": "MIT",
- "files": ["README.md", ".codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/devcycle/replace-feature-flag/src/index.ts b/packages/codemods/devcycle/replace-feature-flag/src/index.ts
deleted file mode 100644
index 7d875d7eb..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/src/index.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-import type { SourceFile } from "ts-morph";
-import { type CallExpression, Node, ts } from "ts-morph";
-
-import { handleSourceFile as handleSourceFileCore } from "../../../replace-feature-flag-core/src/index.js";
-import type {
- Options,
- Provider,
- VariableType,
- VariableValue,
-} from "../../../replace-feature-flag-core/src/types.js";
-
-import {
- buildJSON,
- buildLiteral,
- getCEExpressionName,
-} from "../../../replace-feature-flag-core/src/utils.js";
-
-const { factory } = ts;
-
-const names = [
- "variable",
- "variableValue",
- "useVariable",
- "useDVCVariable",
- "useVariableValue",
-];
-
-const getVariableReplacerNode = (
- key: string,
- type: VariableType,
- value: VariableValue,
-) => {
- return factory.createObjectLiteralExpression(
- [
- factory.createPropertyAssignment(
- factory.createIdentifier("key"),
- factory.createStringLiteral(key),
- ),
- factory.createPropertyAssignment(
- factory.createIdentifier("value"),
- buildLiteral(type, value),
- ),
- factory.createPropertyAssignment(
- factory.createIdentifier("defaultValue"),
- buildLiteral(type, value),
- ),
- factory.createPropertyAssignment(
- factory.createIdentifier("isDefaulted"),
- factory.createTrue(),
- ),
- ],
- true,
- );
-};
-
-const getVariableValueReplacerNode = (
- key: string,
- type: VariableType,
- value: VariableValue,
-) => buildLiteral(type, value);
-
-type MatchedMethod = {
- name: string;
-};
-
-export const provider: Provider = {
- getMatcher:
- (keyName: string) =>
- (ce: CallExpression): MatchedMethod | null => {
- const name = getCEExpressionName(ce);
-
- if (name === null || !names.includes(name)) {
- return null;
- }
-
- const args = ce.getArguments();
- const keyArg = args.length === 3 ? args[1] : args[0];
-
- if (Node.isIdentifier(keyArg)) {
- const maybeVariableDeclaration = keyArg
- .getDefinitions()
- ?.at(0)
- ?.getNode()
- ?.getParent();
-
- if (Node.isVariableDeclaration(maybeVariableDeclaration)) {
- const maybeStringLiteral = maybeVariableDeclaration.getInitializer();
-
- if (
- Node.isStringLiteral(maybeStringLiteral) &&
- maybeStringLiteral.getLiteralText() === keyName
- ) {
- return { name };
- }
- }
- }
-
- if (Node.isStringLiteral(keyArg) && keyArg.getLiteralText() === keyName) {
- return { name };
- }
-
- return null;
- },
- getReplacer: (
- key: string,
- type: VariableType,
- value: VariableValue,
- name: string,
- ) => {
- const node = ["variableValue", "useVariableValue"].includes(name)
- ? getVariableValueReplacerNode(key, type, value)
- : getVariableReplacerNode(key, type, value);
-
- return node;
- },
-};
-
-export function handleSourceFile(
- sourceFile: SourceFile,
- options: Omit,
-): string | undefined {
- return handleSourceFileCore(sourceFile, { ...options, provider });
-}
diff --git a/packages/codemods/devcycle/replace-feature-flag/test/test.ts b/packages/codemods/devcycle/replace-feature-flag/test/test.ts
deleted file mode 100644
index f50e5eab8..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/test/test.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import assert from "node:assert";
-import { readFile } from "node:fs/promises";
-import { extname, join } from "node:path";
-import { Project } from "ts-morph";
-import { describe, it } from "vitest";
-import type { Options } from "../../../replace-feature-flag-core/src/types.js";
-import { handleSourceFile } from "../src/index.js";
-
-const transform = (
- beforeText: string,
- afterText: string,
- path: string,
- options: Omit,
-) => {
- const project = new Project({
- useInMemoryFileSystem: true,
- skipFileDependencyResolution: true,
- compilerOptions: {
- allowJs: true,
- },
- });
-
- const actualSourceFile = project.createSourceFile(path, beforeText);
-
- const actual = handleSourceFile(actualSourceFile, options)?.replace(
- /\s/gm,
- "",
- );
-
- const expected = project
- .createSourceFile(`expected${extname(path)}`, afterText)
- .getFullText()
- .replace(/\s/gm, "");
-
- return {
- actual,
- expected,
- };
-};
-
-describe("Replace feature flag", () => {
- it("Should replace feature flag with boolean value", async () => {
- const INPUT = await readFile(
- join(__dirname, "..", "__testfixtures__/devcycle.input.js"),
- "utf-8",
- );
- const OUTPUT = await readFile(
- join(__dirname, "..", "__testfixtures__/devcycle.output.js"),
- "utf-8",
- );
-
- const { actual, expected } = transform(INPUT, OUTPUT, "index.tsx", {
- key: "simple-case",
- type: "boolean",
- value: "true",
- });
-
- assert.deepEqual(actual, expected);
- });
-
- it("Should replace feature flag with object value", async () => {
- const INPUT = await readFile(
- join(__dirname, "..", "__testfixtures__/object.input.js"),
- "utf-8",
- );
- const OUTPUT = await readFile(
- join(__dirname, "..", "__testfixtures__/object.output.js"),
- "utf-8",
- );
-
- const { actual, expected } = transform(INPUT, OUTPUT, "index.tsx", {
- key: "simple-case",
- type: "JSON",
- value: `{ "foo": { "bar": null, "baz": "str", "faz": 12 } }`,
- });
-
- assert.deepEqual(actual, expected);
- });
-});
diff --git a/packages/codemods/devcycle/replace-feature-flag/tsconfig.json b/packages/codemods/devcycle/replace-feature-flag/tsconfig.json
deleted file mode 100644
index 329a7d63f..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/tsconfig.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "compilerOptions": {
- "baseUrl": ".",
- "outDir": "./dist"
- },
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ],
- "exclude": ["node_modules", "./dist/**/*"],
- "ts-node": {
- "transpileOnly": true
- }
-}
diff --git a/packages/codemods/devcycle/replace-feature-flag/vitest.config.ts b/packages/codemods/devcycle/replace-feature-flag/vitest.config.ts
deleted file mode 100644
index 772ad4c3b..000000000
--- a/packages/codemods/devcycle/replace-feature-flag/vitest.config.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { configDefaults, defineConfig } from "vitest/config";
-
-export default defineConfig({
- test: {
- include: [...configDefaults.include, "**/test/*.ts"],
- },
-});
diff --git a/packages/codemods/ember/5/app-controller-router-props/.codemodrc.json b/packages/codemods/ember/5/app-controller-router-props/.codemodrc.json
deleted file mode 100644
index b7e8bec7a..000000000
--- a/packages/codemods/ember/5/app-controller-router-props/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/app-controller-router-props",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.10.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/app-controller-router-props",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/app-controller-router-props/README.md b/packages/codemods/ember/5/app-controller-router-props/README.md
deleted file mode 100644
index bed97d60f..000000000
--- a/packages/codemods/ember/5/app-controller-router-props/README.md
+++ /dev/null
@@ -1,47 +0,0 @@
-This codemod replaces all occurrences of `this.currentRouteName` with `this.router.currentRouteName`
-and `this.currentPath` with `this.router.currentPath`.
-
-## Before
-
-```jsx
-import Controller from '@ember/controller';
-import fetch from 'fetch';
-
-export default Controller.extend({
- store: service('store'),
-
- actions: {
- sendPayload() {
- fetch('/endpoint', {
- method: 'POST',
- body: JSON.stringify({
- route: this.currentRouteName,
- }),
- });
- },
- },
-});
-```
-
-## After
-
-```tsx
-import Controller from '@ember/controller';
-import fetch from 'fetch';
-
-export default Controller.extend({
- router: service('router'),
- store: service('store'),
-
- actions: {
- sendPayload() {
- fetch('/endpoint', {
- method: 'POST',
- body: JSON.stringify({
- route: this.router.currentRouteName,
- }),
- });
- },
- },
-});
-```
\ No newline at end of file
diff --git a/packages/codemods/ember/5/app-controller-router-props/package.json b/packages/codemods/ember/5/app-controller-router-props/package.json
deleted file mode 100644
index f6e7197e9..000000000
--- a/packages/codemods/ember/5/app-controller-router-props/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-app-controller-router-props",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/app-controller-router-props/src/index.js b/packages/codemods/ember/5/app-controller-router-props/src/index.js
deleted file mode 100644
index 13e3b89b1..000000000
--- a/packages/codemods/ember/5/app-controller-router-props/src/index.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/app-controller-router-props/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- root
- .find(j.MemberExpression, {
- object: { type: "ThisExpression" },
- property: {
- name: "currentRouteName",
- },
- })
- //.forEach(p => console.log(p.parentPath.parentPath))
- .replaceWith(() => {
- root.find(j.ExportDefaultDeclaration).forEach((p) => {
- //console.log(p.value.declaration.arguments[0].properties);
- let props = p.value.declaration.arguments[0].properties;
- props.unshift(
- j.property(
- "init",
- j.identifier("router"),
- j.callExpression(j.identifier("service"), [j.literal("router")]),
- ),
- );
- });
-
- return j.memberExpression(
- j.memberExpression(j.thisExpression(), j.identifier("router"), false),
- j.identifier("currentRouteName"),
- false,
- );
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/app-controller-router-props/test/test.ts b/packages/codemods/ember/5/app-controller-router-props/test/test.ts
deleted file mode 100644
index 3a67cc497..000000000
--- a/packages/codemods/ember/5/app-controller-router-props/test/test.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 app-controller-router-props", () => {
- it("basic", () => {
- const INPUT = `
- import Controller from '@ember/controller';
- import fetch from 'fetch';
-
- export default Controller.extend({
- store: service('store'),
-
- actions: {
- sendPayload() {
- fetch('/endpoint', {
- method: 'POST',
- body: JSON.stringify({
- route: this.currentRouteName
- })
- });
- }
- }
- })
- `;
-
- const OUTPUT = `
- import Controller from '@ember/controller';
- import fetch from 'fetch';
-
- export default Controller.extend({
- router: service("router"),
- store: service('store'),
-
- actions: {
- sendPayload() {
- fetch('/endpoint', {
- method: 'POST',
- body: JSON.stringify({
- route: this.router.currentRouteName
- })
- });
- }
- }
- })
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/app-controller-router-props/tsconfig.json b/packages/codemods/ember/5/app-controller-router-props/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/app-controller-router-props/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/array-wrapper/.codemodrc.json b/packages/codemods/ember/5/array-wrapper/.codemodrc.json
deleted file mode 100644
index c8dfe8dc3..000000000
--- a/packages/codemods/ember/5/array-wrapper/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/array-wrapper",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.6.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/array-wrapper",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/array-wrapper/README.md b/packages/codemods/ember/5/array-wrapper/README.md
deleted file mode 100644
index cf0585f8b..000000000
--- a/packages/codemods/ember/5/array-wrapper/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-This codemod removes any usage of `new` with `A`, and calls `A` as a standard function.
-
-## Before
-
-```jsx
-import { A } from '@ember/array';
-
-let arr = new A();
-```
-
-## After
-
-```tsx
-import { A as emberA } from '@ember/array';
-
-let arr = A();
-```
\ No newline at end of file
diff --git a/packages/codemods/ember/5/array-wrapper/package.json b/packages/codemods/ember/5/array-wrapper/package.json
deleted file mode 100644
index 0667acb13..000000000
--- a/packages/codemods/ember/5/array-wrapper/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-array-wrapper",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/array-wrapper/src/index.js b/packages/codemods/ember/5/array-wrapper/src/index.js
deleted file mode 100644
index 49f8ed4d8..000000000
--- a/packages/codemods/ember/5/array-wrapper/src/index.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*! @license
-
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/array-wrapper/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- root
- .find(j.NewExpression, {
- callee: {
- name: "A",
- },
- })
- .replaceWith(() => {
- root
- .find(j.ImportSpecifier, {
- imported: { name: "A" },
- local: { name: "A" },
- })
- .replaceWith(() => {
- return j.importSpecifier(j.identifier("A"), j.identifier("emberA"));
- });
-
- return j.callExpression(j.identifier("A"), []);
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/array-wrapper/test/test.ts b/packages/codemods/ember/5/array-wrapper/test/test.ts
deleted file mode 100644
index ad8317198..000000000
--- a/packages/codemods/ember/5/array-wrapper/test/test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 array-wrapper", () => {
- it("basic", () => {
- const INPUT = `
- import { A } from '@ember/array';
- let arr = new A();
- `;
-
- const OUTPUT = `
- import { A as emberA } from '@ember/array';
- let arr = A();
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/array-wrapper/tsconfig.json b/packages/codemods/ember/5/array-wrapper/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/array-wrapper/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/convert-module-for-to-setup-test/.codemodrc.json b/packages/codemods/ember/5/convert-module-for-to-setup-test/.codemodrc.json
deleted file mode 100644
index 90bbe1715..000000000
--- a/packages/codemods/ember/5/convert-module-for-to-setup-test/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/convert-module-for-to-setup-test",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "2.4.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-qunit-codemod/tree/master/transforms/convert-module-for-to-setup-test",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/convert-module-for-to-setup-test/README.md b/packages/codemods/ember/5/convert-module-for-to-setup-test/README.md
deleted file mode 100644
index 010c98bb2..000000000
--- a/packages/codemods/ember/5/convert-module-for-to-setup-test/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-This codemod transforms from the older `moduleFor*` syntax of `ember-qunit@2` to the newer `setup*Test` syntax.
-
-## Before
-
-```tsx
-import { moduleFor, test } from 'ember-qunit';
-
-moduleFor('service:flash', 'Unit | Service | Flash', {
- unit: true,
-});
-
-test('should allow messages to be queued', function (assert) {
- let subject = this.subject();
-});
-```
-
-## After
-
-```tsx
-import { setupTest } from 'ember-qunit';
-import { module, test } from 'qunit';
-
-module('Unit | Service | Flash', function (hooks) {
- setupTest(hooks);
-
- test('should allow messages to be queued', function (assert) {
- let subject = this.owner.lookup('service:flash');
- });
-});
-```
\ No newline at end of file
diff --git a/packages/codemods/ember/5/convert-module-for-to-setup-test/package.json b/packages/codemods/ember/5/convert-module-for-to-setup-test/package.json
deleted file mode 100644
index 5658e388c..000000000
--- a/packages/codemods/ember/5/convert-module-for-to-setup-test/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-convert-module-for-to-setup-test",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/convert-module-for-to-setup-test/src/index.js b/packages/codemods/ember/5/convert-module-for-to-setup-test/src/index.js
deleted file mode 100644
index af81912ba..000000000
--- a/packages/codemods/ember/5/convert-module-for-to-setup-test/src/index.js
+++ /dev/null
@@ -1,1073 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-qunit-codemod/blob/master/transforms/convert-module-for-to-setup-test/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- const POSSIBLE_MODULES = [
- { expression: { callee: { name: "module" } } },
- { expression: { callee: { name: "moduleFor" } } },
- { expression: { callee: { name: "moduleForComponent" } } },
- { expression: { callee: { name: "moduleForModel" } } },
- { expression: { callee: { name: "moduleForAcceptance" } } },
- ];
-
- class ModuleInfo {
- static isModuleDefinition(nodePath) {
- return POSSIBLE_MODULES.some((matcher) => j.match(nodePath, matcher));
- }
-
- constructor(p) {
- let calleeName = p.node.expression.callee.name;
- // Find the moduleName and the module's options
- let moduleName,
- subject,
- options,
- hasCustomSubject,
- hasIntegrationFlag,
- isNestedModule,
- moduleCallback,
- moduleCallbackBody;
- let calleeArguments = p.node.expression.arguments.slice();
- let lastArgument = calleeArguments[calleeArguments.length - 1];
- if (lastArgument.type === "ObjectExpression") {
- options = calleeArguments.pop();
- }
-
- if (calleeArguments.length === 3) {
- isNestedModule = true;
- moduleName = calleeArguments[0];
- options = calleeArguments[1];
- moduleCallback = calleeArguments[2];
- moduleCallbackBody = moduleCallback.body.body;
- } else if (
- calleeArguments[1] &&
- (j.match(calleeArguments[1], { type: "FunctionExpression" }) ||
- j.match(calleeArguments[1], {
- type: "ArrowFunctionExpression",
- }))
- ) {
- isNestedModule = true;
- moduleName = calleeArguments[0];
- moduleCallback = calleeArguments[1];
- moduleCallbackBody = moduleCallback.body.body;
- } else {
- moduleName = calleeArguments[1] || calleeArguments[0];
- subject = calleeArguments[0];
- }
-
- let setupIdentifier = calleeName === "module" ? null : "setupTest";
- if (options) {
- hasIntegrationFlag = options.properties.some(
- (p) => p.key.name === "integration",
- );
- hasCustomSubject = options.properties.some(
- (p) => p.key.name === "subject",
- );
- }
-
- if (calleeName === `moduleForAcceptance`) {
- setupIdentifier = "setupApplicationTest";
- subject = null;
- } else if (calleeName === `moduleForComponent`) {
- if (hasIntegrationFlag) {
- setupIdentifier = "setupRenderingTest";
- subject = null;
- } else {
- subject = j.literal(`component:${calleeArguments[0].value}`);
- }
- } else if (calleeName === "moduleForModel") {
- subject = j.literal(`model:${calleeArguments[0].value}`);
- }
-
- this.comments = p.node.comments;
- this.trailingComments = p.node.trailingComments;
-
- this.originalSetupType = calleeName;
- this.moduleName = moduleName;
- this.moduleOptions = options;
- this.setupType = setupIdentifier;
- this.subjectContainerKey = subject;
- this.hasCustomSubjectImplementation = hasCustomSubject;
- this.isNestedModule = isNestedModule;
-
- this.moduleInvocation = null;
- this.moduleCallbackBody = moduleCallbackBody;
- this.moduleCallback = moduleCallback;
- }
- }
-
- function ensureImportWithSpecifiers(options) {
- let source = options.source;
- let specifiers = options.specifiers;
- let anchor = options.anchor;
- let positionMethod = options.positionMethod;
-
- let importStatement = ensureImport(source, anchor, positionMethod);
- let combinedSpecifiers = new Set(specifiers);
-
- importStatement
- .find(j.ImportSpecifier)
- .forEach((i) => combinedSpecifiers.add(i.node.imported.name))
- .remove();
-
- importStatement.get("specifiers").replace(
- Array.from(combinedSpecifiers)
- .sort()
- .map((s) => j.importSpecifier(j.identifier(s))),
- );
- }
-
- function ensureImport(source, anchor, method) {
- method = method || "insertAfter";
-
- let desiredImport = root.find(j.ImportDeclaration, {
- source: { value: source },
- });
- if (desiredImport.size() > 0) {
- return desiredImport;
- }
-
- let newImport = j.importDeclaration([], j.literal(source));
- let anchorImport = root.find(j.ImportDeclaration, {
- source: { value: anchor },
- });
- let imports = root.find(j.ImportDeclaration);
- if (anchorImport.size() > 0) {
- anchorImport.at(anchorImport.size() - 1)[method](newImport);
- } else if (imports.size() > 0) {
- // if anchor is not present, always add at the end
- imports.at(imports.size() - 1).insertAfter(newImport);
- } else {
- // if no imports are present, add as first statement
- root.get().node.program.body.unshift(newImport);
- }
-
- return j(newImport);
- }
-
- function moveQUnitImportsFromEmberQUnit() {
- let emberQUnitImports = root.find(j.ImportDeclaration, {
- source: { value: "ember-qunit" },
- });
- // Find `module` and `test` imports
- let migrateToQUnitImport = ["module", "test", "skip", "todo"];
-
- let specifiers = new Set();
- // Replace old with new test helpers imports
- emberQUnitImports
- .find(j.ImportSpecifier)
- .filter((p) => migrateToQUnitImport.indexOf(p.node.imported.name) !== -1)
- .forEach((p) => specifiers.add(p.node.imported.name))
- .remove();
-
- if (specifiers.size === 0) {
- return;
- }
-
- ensureImportWithSpecifiers({
- source: "qunit",
- anchor: "ember-qunit",
- positionMethod: "insertBefore",
- specifiers,
- });
- }
-
- function updateToNewEmberQUnitImports() {
- let mapping = {
- moduleFor: "setupTest",
- moduleForComponent: "setupRenderingTest",
- moduleForModel: "setupTest",
- };
-
- let emberQUnitImports = root.find(j.ImportDeclaration, {
- source: { value: "ember-qunit" },
- });
- if (emberQUnitImports.size() === 0) {
- return;
- }
-
- // Collect all imports from ember-qunit into local array
- let emberQUnitSpecifiers = new Set();
-
- emberQUnitImports
- .find(j.ImportSpecifier)
- .forEach((p) => {
- // Map them to the new imports
- let importName = p.node.imported.name;
- let mappedName = mapping[importName] || importName;
-
- if (mappedName !== importName) {
- ensureImportWithSpecifiers({
- source: "qunit",
- anchor: "ember-qunit",
- positionMethod: "insertBefore",
- specifiers: ["module"],
- });
- }
-
- // If importName is `moduleForComponent` determine if we need
- // `setupTest` (unit) or `setupRenderingTest` (integration)
- if (importName === "moduleForComponent") {
- root
- .find(j.ExpressionStatement, {
- expression: {
- callee: { name: "moduleForComponent" },
- },
- })
- .forEach((p) => {
- let moduleInfo = new ModuleInfo(p);
- emberQUnitSpecifiers.add(moduleInfo.setupType);
- });
- } else {
- emberQUnitSpecifiers.add(mappedName);
- }
- })
- // Remove all existing import specifiers
- .remove();
-
- emberQUnitImports
- .get("specifiers")
- .replace(
- Array.from(emberQUnitSpecifiers).map((s) =>
- j.importSpecifier(j.identifier(s)),
- ),
- );
-
- // If we have an empty import, remove the import declaration
- if (emberQUnitSpecifiers.size === 0) {
- emberQUnitImports.remove();
- }
- }
-
- // find moduleForAcceptance import and replace with 'module'
- function migrateModuleForAcceptanceTests() {
- let imports = root.find(j.ImportDeclaration);
- imports
- .find(j.ImportDefaultSpecifier, {
- local: {
- type: "Identifier",
- name: "moduleForAcceptance",
- },
- })
- .forEach((p) => {
- // add setupApplicationTest import
- ensureImportWithSpecifiers({
- source: "ember-qunit",
- anchor: "qunit",
- specifiers: ["setupApplicationTest"],
- });
- // ensure module import if acceptance test
- ensureImportWithSpecifiers({
- source: "qunit",
- specifiers: ["module"],
- });
- // remove existing moduleForAcceptance import
- j(p.parentPath.parentPath).remove();
- });
- }
-
- function findApplicationTestHelperUsageOf(collection, property) {
- return collection.find(j.ExpressionStatement, {
- expression: {
- callee: {
- type: "Identifier",
- name: property,
- },
- },
- });
- }
-
- function findTestHelperUsageOf(collection, property) {
- return collection.find(j.ExpressionStatement, {
- expression: {
- callee: {
- object: {
- type: "ThisExpression",
- },
- property: {
- name: property,
- },
- },
- },
- });
- }
-
- function addHooksParam(moduleInfo) {
- moduleInfo.moduleCallback.params = [j.identifier("hooks")];
- }
-
- function addToBeforeEach(moduleInfo, expression) {
- let beforeEachBody = moduleInfo.moduleBeforeEachBody;
- if (!beforeEachBody) {
- if (moduleInfo.moduleCallback) {
- addHooksParam(moduleInfo);
- }
-
- let beforeEachBlockStatement = j.blockStatement([]);
- let beforeEachExpression = j.expressionStatement(
- j.callExpression(
- j.memberExpression(j.identifier("hooks"), j.identifier("beforeEach")),
- [
- j.functionExpression(
- null,
- [
- /* no arguments */
- ],
- beforeEachBlockStatement,
- ),
- ],
- ),
- );
-
- beforeEachBody = moduleInfo.moduleBeforeEachBody =
- beforeEachBlockStatement.body;
- let insertAt = moduleInfo.setupType ? 1 : 0;
- moduleInfo.moduleCallbackBody.splice(insertAt, 0, beforeEachExpression);
- }
-
- beforeEachBody.push(expression);
- }
-
- function updateModuleForToNestedModule() {
- const LIFE_CYCLE_METHODS = [
- { key: { name: "before" }, value: { type: "FunctionExpression" } },
- { type: "ObjectMethod", key: { name: "before" } },
- {
- key: { name: "beforeEach" },
- value: { type: "FunctionExpression" },
- },
- { type: "ObjectMethod", key: { name: "beforeEach" } },
- {
- key: { name: "afterEach" },
- value: { type: "FunctionExpression" },
- },
- { type: "ObjectMethod", key: { name: "afterEach" } },
- { key: { name: "after" }, value: { type: "FunctionExpression" } },
- { type: "ObjectMethod", key: { name: "after" } },
- ];
-
- function isLifecycleHook(nodePath) {
- return LIFE_CYCLE_METHODS.some((matcher) => j.match(nodePath, matcher));
- }
-
- function createModule(p) {
- let moduleInfo = new ModuleInfo(p);
-
- let needsHooks = false;
- let moduleSetupExpression;
-
- if (moduleInfo.setupType) {
- needsHooks = true;
- moduleSetupExpression = j.expressionStatement(
- j.callExpression(j.identifier(moduleInfo.setupType), [
- j.identifier("hooks"),
- ]),
- );
- moduleInfo.moduleSetupExpression = moduleSetupExpression;
- }
-
- let callback = moduleInfo.moduleCallback;
- if (!callback) {
- // Create the new `module(moduleName, function(hooks) {});` invocation
- callback = j.functionExpression(
- null /* no function name */,
- [],
- j.blockStatement([moduleSetupExpression].filter(Boolean)),
- );
- moduleInfo.moduleCallbackBody = callback.body.body;
- moduleInfo.moduleCallback = callback;
- }
- function buildModule(moduleName, callback) {
- // using j.callExpression() builds this:
-
- // module(
- // 'some loooooooooooong name',
- // function(hooks) {
- // setupTest(hooks);
- // }
- // );
-
- // but we want to enforce not having line breaks in the module() invocation
- // so we'll have to use a little hack to get this:
-
- // module('some loooooooooooong name', function(hooks) {
- // setupTest(hooks);
- // });
-
- let node = j(`module('moduleName', function(hooks) {})`)
- .find(j.CallExpression)
- .paths()[0].node;
-
- node.arguments[0] = moduleName;
- node.arguments[1] = callback;
-
- return node;
- }
-
- let moduleInvocation = j.expressionStatement(
- buildModule(moduleInfo.moduleName, callback),
- );
-
- if (moduleInfo.moduleOptions) {
- let insertLocation;
- if (moduleInfo.isNestedModule) {
- insertLocation = 0;
- } else {
- callback.body.body.length;
- }
-
- moduleInfo.moduleOptions.properties.forEach((property) => {
- let value =
- property.type === "ObjectMethod"
- ? j.functionExpression(null, property.params, property.body)
- : property.value;
-
- if (property.async) {
- value.async = true;
- }
-
- if (moduleInfo.setupType) {
- let expressionCollection = j(value);
-
- updateGetOwnerThisUsage(expressionCollection);
- updateLookupCalls(expressionCollection);
- updateRegisterCalls(expressionCollection);
- updateInjectCalls(expressionCollection);
- updateOnCalls(expressionCollection, moduleInfo);
-
- if (j.match(property, { key: { name: "resolver" } })) {
- let setupExpression = moduleInfo.moduleSetupExpression;
- setupExpression.expression.arguments.push(
- j.objectExpression([property]),
- );
- return;
- }
- }
-
- if (isLifecycleHook(property)) {
- needsHooks = true;
- let lifecycleStatement = j.expressionStatement(
- j.callExpression(
- j.memberExpression(j.identifier("hooks"), property.key),
- [value],
- ),
- );
-
- // preserve any comments that were present
- lifecycleStatement.comments = property.comments;
-
- if (moduleInfo.isNestedModule) {
- callback.body.body.splice(insertLocation, 0, lifecycleStatement);
- insertLocation++;
- } else {
- callback.body.body.push(lifecycleStatement);
- }
- } else {
- const IGNORED_PROPERTIES = ["integration", "needs", "unit"];
- if (IGNORED_PROPERTIES.indexOf(property.key.name) !== -1) {
- return;
- }
-
- let methodAssignment = j.expressionStatement(
- j.assignmentExpression(
- "=",
- j.memberExpression(j.thisExpression(), property.key),
- value,
- ),
- );
-
- // preserve any comments that were present
- methodAssignment.comments = property.comments;
-
- addToBeforeEach(moduleInfo, methodAssignment);
- }
- });
-
- if (moduleInfo.setupType === "setupRenderingTest") {
- processExpressionForRenderingTest(callback);
- } else {
- processSubject(callback, moduleInfo);
- processStore(callback, moduleInfo);
- }
- }
-
- moduleInvocation.comments = moduleInfo.comments;
- moduleInvocation.trailingComments = moduleInfo.trailingComments;
- moduleInfo.moduleInvocation = moduleInvocation;
-
- if (needsHooks === true) {
- addHooksParam(moduleInfo);
- }
-
- return moduleInfo;
- }
-
- function removeAndThens(testExpressionCollection) {
- let replacements = testExpressionCollection
- .find(j.CallExpression, {
- callee: {
- name: "andThen",
- },
- })
- .map((path) => path.parent)
- .replaceWith((p) => {
- let body = p.node.expression.arguments[0].body;
-
- return body.body || j.expressionStatement(body);
- });
-
- if (replacements.length > 0) {
- removeAndThens(testExpressionCollection);
- }
- }
-
- function processExpressionForApplicationTest(testExpression) {
- // mark the test function as an async function
- let testExpressionCollection = j(testExpression);
- // collect all potential statements to be imported
- let specifiers = new Set();
-
- // First - remove andThen blocks
- removeAndThens(testExpressionCollection);
-
- // Second - Transform to await visit(), click, fillIn, touch, etc and adds `async` to scope
- [
- "visit",
- "find",
- "waitFor",
- "fillIn",
- "click",
- "blur",
- "focus",
- "tap",
- "triggerEvent",
- "triggerKeyEvent",
- ].forEach((type) => {
- findApplicationTestHelperUsageOf(
- testExpressionCollection,
- type,
- ).forEach((p) => {
- specifiers.add(type);
-
- let expression = p.get("expression");
-
- let awaitExpression = j.awaitExpression(
- j.callExpression(j.identifier(type), expression.node.arguments),
- );
- expression.replace(awaitExpression);
- p.scope.node.async = true;
- });
- });
-
- // Third - update call expressions that do not await
- ["currentURL", "currentRouteName"].forEach((type) => {
- testExpressionCollection
- .find(j.CallExpression, {
- callee: {
- type: "Identifier",
- name: type,
- },
- })
- .forEach(() => specifiers.add(type));
- });
- }
-
- function processExpressionForRenderingTest(testExpression) {
- // mark the test function as an async function
- let testExpressionCollection = j(testExpression);
- let specifiers = new Set();
-
- // Transform to await render() or await clearRender()
- ["render", "clearRender"].forEach((type) => {
- findTestHelperUsageOf(testExpressionCollection, type).forEach((p) => {
- specifiers.add(type);
-
- let expression = p.get("expression");
-
- let awaitExpression = j.awaitExpression(
- j.callExpression(j.identifier(type), expression.node.arguments),
- );
- expression.replace(awaitExpression);
- p.scope.node.async = true;
- });
- });
-
- ensureImportWithSpecifiers({
- source: "@ember/test-helpers",
- anchor: "ember-qunit",
- specifiers,
- });
-
- // Migrate `this._element` -> `this.element`
- testExpressionCollection
- .find(j.MemberExpression, {
- object: {
- type: "ThisExpression",
- },
- property: {
- name: "_element",
- },
- })
- .forEach((p) => {
- let property = p.get("property");
- property.node.name = "element";
- });
- }
-
- function processStore(testExpression, moduleInfo) {
- if (moduleInfo.originalSetupType !== "moduleForModel") {
- return;
- }
-
- let thisDotStoreUsage = j(testExpression).find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: {
- type: "ThisExpression",
- },
- property: {
- name: "store",
- },
- },
- });
-
- if (thisDotStoreUsage.size() === 0) {
- return;
- }
-
- thisDotStoreUsage.forEach((p) => {
- p.replace(
- j.callExpression(
- j.memberExpression(
- j.memberExpression(j.thisExpression(), j.identifier("owner")),
- j.identifier("lookup"),
- ),
- [j.literal("service:store")],
- ),
- );
- });
- }
-
- function processSubject(testExpression, moduleInfo) {
- let subject = moduleInfo.subjectContainerKey;
- let thisDotSubjectUsage = j(testExpression).find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: {
- type: "ThisExpression",
- },
- property: {
- name: "subject",
- },
- },
- });
-
- if (thisDotSubjectUsage.size() === 0) {
- return;
- }
-
- thisDotSubjectUsage.forEach((p) => {
- let options = p.node.arguments[0];
- let split = subject.value.split(":");
- let subjectType = split[0];
- let subjectName = split[1];
- let isSingletonSubject =
- ["model", "component"].indexOf(subjectType) === -1;
-
- // if we don't have `options` and the type is a singleton type
- // use `this.owner.lookup(subject)`
- if (!options && isSingletonSubject) {
- p.replace(
- j.callExpression(
- j.memberExpression(
- j.memberExpression(j.thisExpression(), j.identifier("owner")),
- j.identifier("lookup"),
- ),
- [subject],
- ),
- );
- } else if (subjectType === "model") {
- ensureImportWithSpecifiers({
- source: "@ember/runloop",
- specifiers: ["run"],
- });
-
- p.replace(
- j.callExpression(j.identifier("run"), [
- j.arrowFunctionExpression(
- [],
- j.callExpression(
- j.memberExpression(
- j.callExpression(
- j.memberExpression(
- j.memberExpression(
- j.thisExpression(),
- j.identifier("owner"),
- ),
- j.identifier("lookup"),
- ),
- [j.literal("service:store")],
- ),
- j.identifier("createRecord"),
- ),
- [j.literal(subjectName), options].filter(Boolean),
- ),
- true,
- ),
- ]),
- );
- } else {
- p.replace(
- j.callExpression(
- j.memberExpression(
- j.callExpression(
- j.memberExpression(
- j.memberExpression(
- j.thisExpression(),
- j.identifier("owner"),
- ),
- j.identifier("factoryFor"),
- ),
- [subject],
- ),
- j.identifier("create"),
- ),
- [options].filter(Boolean),
- ),
- );
- }
- });
- }
-
- function processBody(bodyPath) {
- let currentModuleInfo;
- bodyPath.each((expressionPath) => {
- let expression = expressionPath.node;
- if (ModuleInfo.isModuleDefinition(expressionPath)) {
- let moduleInfo = createModule(expressionPath);
- expressionPath.replace(moduleInfo.moduleInvocation);
-
- if (moduleInfo.isNestedModule) {
- processBody(j(moduleInfo.moduleCallback).get("body").get("body"));
- return;
- }
-
- currentModuleInfo = moduleInfo;
- } else if (currentModuleInfo) {
- // calling `path.replace()` essentially just removes
- expressionPath.replace();
- currentModuleInfo.moduleCallbackBody.push(expression);
-
- let isTest = j.match(expression, {
- expression: { callee: { name: "test" } },
- });
- if (isTest) {
- let expressionCollection = j(expression);
- updateLookupCalls(expressionCollection);
- updateRegisterCalls(expressionCollection);
- updateInjectCalls(expressionCollection);
- updateOnCalls(expressionCollection, currentModuleInfo);
- // passing the specific function callback here, because `getOwner` is only
- // transformed if the call site's scope is the same as the expression passed
- updateGetOwnerThisUsage(j(expression.expression.arguments[1]));
- processStore(expression, currentModuleInfo);
-
- if (currentModuleInfo.setupType === "setupApplicationTest") {
- processExpressionForApplicationTest(expression);
- } else if (currentModuleInfo.setupType === "setupRenderingTest") {
- processExpressionForRenderingTest(expression);
- } else if (
- currentModuleInfo.setupType === "setupTest" &&
- !currentModuleInfo.hasCustomSubjectImplementation
- ) {
- processSubject(expression, currentModuleInfo);
- }
- }
- }
- });
- }
-
- let programPath = root.get("program");
- let bodyPath = programPath.get("body");
-
- processBody(bodyPath);
- }
-
- function updateLookupCalls(ctx) {
- ctx
- .find(j.MemberExpression, {
- object: {
- object: { type: "ThisExpression" },
- property: { name: "container" },
- },
- property: { name: "lookup" },
- })
- .forEach((path) => {
- let thisDotOwner = j.memberExpression(
- j.thisExpression(),
- j.identifier("owner"),
- );
- path.replace(j.memberExpression(thisDotOwner, path.value.property));
- });
- }
-
- function updateRegisterCalls(ctx) {
- ctx
- .find(j.MemberExpression, {
- object: {
- object: { type: "ThisExpression" },
- property: { name: "registry" },
- },
- property: { name: "register" },
- })
- .forEach((path) => {
- let thisDotOwner = j.memberExpression(
- j.thisExpression(),
- j.identifier("owner"),
- );
- path.replace(j.memberExpression(thisDotOwner, path.value.property));
- });
-
- ctx
- .find(j.MemberExpression, {
- object: { type: "ThisExpression" },
- property: { name: "register" },
- })
- .forEach((path) => {
- let thisDotOwner = j.memberExpression(
- j.thisExpression(),
- j.identifier("owner"),
- );
- path.replace(j.memberExpression(thisDotOwner, path.value.property));
- });
- }
-
- function updateOnCalls(ctx, moduleInfo) {
- let usages = ctx.find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: {
- type: "ThisExpression",
- },
- property: {
- name: "on",
- },
- },
- });
-
- usages.forEach((p) => {
- let actionName = p.node.arguments[0].value;
- let property = j.identifier(actionName);
-
- if (!actionName.match(/^[a-zA-Z_][a-zA-Z0-9]+$/)) {
- // if not, use `this['property-name']`
- property = j.literal(actionName);
- }
-
- let assignment = j.assignmentExpression(
- "=",
- j.memberExpression(
- j.memberExpression(j.thisExpression(), j.identifier("actions")),
- property,
- ),
- p.node.arguments[1],
- );
- p.replace(assignment);
- });
-
- if (usages.size() > 0 && !moduleInfo.hasSendFunctionInBeforeEach) {
- moduleInfo.hasSendFunctionInBeforeEach = true;
-
- addToBeforeEach(
- moduleInfo,
- j.expressionStatement(
- j.assignmentExpression(
- "=",
- j.memberExpression(j.thisExpression(), j.identifier("actions")),
- j.objectExpression([]),
- ),
- ),
- );
-
- addToBeforeEach(
- moduleInfo,
- j.expressionStatement(
- j.assignmentExpression(
- "=",
- j.memberExpression(j.thisExpression(), j.identifier("send")),
- j.arrowFunctionExpression(
- [j.identifier("actionName"), j.restElement(j.identifier("args"))],
- j.callExpression(
- j.memberExpression(
- j.memberExpression(
- j.memberExpression(
- j.thisExpression(),
- j.identifier("actions"),
- ),
- j.identifier("actionName"),
- true,
- ),
- j.identifier("apply"),
- ),
- [j.thisExpression(), j.identifier("args")],
- ),
- ),
- ),
- ),
- );
- }
- }
-
- function updateInjectCalls(ctx) {
- ctx
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: {
- object: {
- type: "ThisExpression",
- },
- property: {
- name: "inject",
- },
- },
- },
- })
- .forEach((p) => {
- let injectType = p.node.callee.property.name;
- let injectedName = p.node.arguments[0].value;
- let localName = injectedName;
- if (p.node.arguments[1]) {
- let options = p.node.arguments[1];
- let as = options.properties.find(
- (property) => property.key.name === "as",
- );
- if (as) {
- localName = as.value.value;
- }
- }
- let property = j.identifier(localName);
- // rudimentary attempt to confirm the property name is valid
- // as `this.propertyName`
- if (!localName.match(/^[a-zA-Z_][a-zA-Z0-9]+$/)) {
- // if not, use `this['property-name']`
- property = j.literal(localName);
- }
- let assignment = j.assignmentExpression(
- "=",
- j.memberExpression(j.thisExpression(), property),
- j.callExpression(
- j.memberExpression(
- j.memberExpression(j.thisExpression(), j.identifier("owner")),
- j.identifier("lookup"),
- ),
- [j.literal(`${injectType}:${injectedName}`)],
- ),
- );
-
- p.replace(assignment);
- });
- }
-
- function updateGetOwnerThisUsage(expressionCollection) {
- let expression = expressionCollection.get().node;
- let thisDotOwner = j.memberExpression(
- j.thisExpression(),
- j.identifier("owner"),
- );
-
- function replacement(path) {
- if (path.scope.node === expression) {
- path.replace(thisDotOwner);
- }
- }
-
- expressionCollection
- .find(j.CallExpression, {
- callee: {
- name: "getOwner",
- },
- })
- .forEach(replacement);
-
- expressionCollection
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: {
- name: "Ember",
- },
- property: {
- name: "getOwner",
- },
- },
- })
- .forEach(replacement);
- }
-
- function updateWaitUsage() {
- let waitImport = root.find(j.ImportDeclaration, {
- source: { value: "ember-test-helpers/wait" },
- });
-
- if (waitImport.size() > 0) {
- let importedName;
-
- ensureImportWithSpecifiers({
- source: "@ember/test-helpers",
- anchor: "ember-qunit",
- specifiers: ["settled"],
- });
-
- waitImport
- .find(j.ImportDefaultSpecifier)
- .forEach((p) => (importedName = p.node.local.name));
- waitImport.remove();
-
- root
- .find(j.CallExpression, {
- callee: { name: importedName },
- })
- .forEach((p) => {
- p.node.callee.name = "settled";
- });
- }
- }
-
- const printOptions = { quote: "single", wrapColumn: 100 };
-
- moveQUnitImportsFromEmberQUnit();
- updateToNewEmberQUnitImports();
- migrateModuleForAcceptanceTests();
- updateModuleForToNestedModule();
- updateWaitUsage();
-
- return root.toSource(printOptions);
-}
diff --git a/packages/codemods/ember/5/convert-module-for-to-setup-test/test/test.ts b/packages/codemods/ember/5/convert-module-for-to-setup-test/test/test.ts
deleted file mode 100644
index cce4a121b..000000000
--- a/packages/codemods/ember/5/convert-module-for-to-setup-test/test/test.ts
+++ /dev/null
@@ -1,2206 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-/**
- * These test fixtures are based on public tests, which is subject to the original license terms.
- * Original tests: https://github.com/ember-codemods/ember-qunit-codemod/tree/master/transforms/convert-module-for-to-setup-test/__testfixtures__
- *
- * License:
- MIT License
-
- Copyright (c) 2019 ember-codemods
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- * License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
- */
-
-describe("ember 5 convert-module-for-to-setup-test", () => {
- it("basic-typescript-support", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:flash', 'Unit | Service | Flash', {
- unit: true
- });
-
- test('should allow messages to be queued', function (assert) {
- let subject = this.subject();
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | Flash', function(hooks) {
- setupTest(hooks);
-
- test('should allow messages to be queued', function (assert) {
- let subject = this.owner.lookup('service:flash');
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("ts"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("custom-functions-in-options", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('stuff:here', {
- customFunction() {
- return stuff();
- }
- });
-
- test('users customFunction', function(assert) {
- let custom = this.customFunction();
- });
-
- moduleFor('stuff:here', {
- customFunction() {
- return stuff();
- },
-
- otherThing(basedOn) {
- return this.blah(basedOn);
- }
- });
-
- test('can have two', function(assert) {
- let custom = this.customFunction();
- let other = this.otherThing();
- });
-
- moduleFor('foo:bar', {
- m3: true,
- });
-
- test('can access', function(assert) {
- let usesM3 = this.m3;
- });
-
- moduleFor('foo:bar', {
- m3: true,
-
- beforeEach() {
- doStuff();
- },
- });
-
- test('separate \`hooks.beforeEach\` than lifecycle hooks', function(assert) {
- let usesM3 = this.m3;
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('stuff:here', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- this.customFunction = function() {
- return stuff();
- };
- });
-
- test('users customFunction', function(assert) {
- let custom = this.customFunction();
- });
- });
-
- module('stuff:here', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- this.customFunction = function() {
- return stuff();
- };
-
- this.otherThing = function(basedOn) {
- return this.blah(basedOn);
- };
- });
-
- test('can have two', function(assert) {
- let custom = this.customFunction();
- let other = this.otherThing();
- });
- });
-
- module('foo:bar', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- this.m3 = true;
- });
-
- test('can access', function(assert) {
- let usesM3 = this.m3;
- });
- });
-
- module('foo:bar', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- this.m3 = true;
- });
-
- hooks.beforeEach(function() {
- doStuff();
- });
-
- test('separate \`hooks.beforeEach\` than lifecycle hooks', function(assert) {
- let usesM3 = this.m3;
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("custom-module-for-implementation", () => {
- const INPUT = `
- import moduleForComponent from '../helpers/module-for-component';
- import { test } from 'ember-qunit';
-
- moduleForOtherComponent('foo-bar', 'Integration | Component | FooBar', {
- integration: true
- });
-
- test('it does not get changed', function() {
- this.render(hbs\`derp\`);
- });
- `;
-
- const OUTPUT = `
- import moduleForComponent from '../helpers/module-for-component';
- import { test } from 'qunit';
-
- moduleForOtherComponent('foo-bar', 'Integration | Component | FooBar', {
- integration: true
- });
-
- test('it does not get changed', function() {
- this.render(hbs\`derp\`);
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("get-owner-this", () => {
- const INPUT = `
- import Service from '@ember/service';
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:flash', 'Unit | Service | Flash', {
- unit: true
- });
-
- test('can fix getOwner(this) usage in a test', function (assert) {
- let owner = getOwner(this);
- });
-
- moduleFor('service:flash', 'Unit | Service | Flash', {
- unit: true,
- beforeEach() {
- let owner = getOwner(this);
- }
- });
-
- test('can use getOwner(this) in beforeEach', function (assert) {
- // stuff
- });
-
- moduleFor('service:flash', 'Unit | Service | Flash', {
- unit: true
- });
-
- test('can use Ember.getOwner(this) also', function (assert) {
- let owner = Ember.getOwner(this);
- });
-
- test('objects registered can continue to use \`getOwner(this)\`', function(assert) {
- this.register('service:foo', Service.extend({
- someMethod() {
- let owner = getOwner(this);
- return owner.lookup('other:thing').someMethod();
- }
- }));
- });
-
- moduleFor('service:flash', {
- beforeEach() {
- this.blah = getOwner(this).lookup('service:blah');
- this.register('service:foo', Service.extend({
- someMethod() {
- let owner = getOwner(this);
- return owner.lookup('other:thing').someMethod();
- }
- }));
- }
- });
-
- test('can use getOwner(this) in beforeEach for each context', function (assert) {
- // stuff
- });
- `;
-
- const OUTPUT = `
- import Service from '@ember/service';
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | Flash', function(hooks) {
- setupTest(hooks);
-
- test('can fix getOwner(this) usage in a test', function (assert) {
- let owner = this.owner;
- });
- });
-
- module('Unit | Service | Flash', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- let owner = this.owner;
- });
-
- test('can use getOwner(this) in beforeEach', function (assert) {
- // stuff
- });
- });
-
- module('Unit | Service | Flash', function(hooks) {
- setupTest(hooks);
-
- test('can use Ember.getOwner(this) also', function (assert) {
- let owner = this.owner;
- });
-
- test('objects registered can continue to use \`getOwner(this)\`', function(assert) {
- this.owner.register('service:foo', Service.extend({
- someMethod() {
- let owner = getOwner(this);
- return owner.lookup('other:thing').someMethod();
- }
- }));
- });
- });
-
- module('service:flash', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- this.blah = this.owner.lookup('service:blah');
- this.owner.register('service:foo', Service.extend({
- someMethod() {
- let owner = getOwner(this);
- return owner.lookup('other:thing').someMethod();
- }
- }));
- });
-
- test('can use getOwner(this) in beforeEach for each context', function (assert) {
- // stuff
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("global-wait", () => {
- const INPUT = `
- import { test } from 'qunit';
- import moduleForAcceptance from '../helpers/module-for-acceptance';
-
- moduleForAcceptance('something');
-
- test('uses global helpers', function(assert) {
- visit('/something');
-
- wait().then(() => assert.ok(true));
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupApplicationTest } from 'ember-qunit';
-
- module('something', function(hooks) {
- setupApplicationTest(hooks);
-
- test('uses global helpers', async function(assert) {
- await visit('/something');
-
- wait().then(() => assert.ok(true));
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("inject", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:foo-bar', 'Unit | Service | FooBar', {
- });
-
- test('it exists', function(assert) {
- this.inject.service('foo');
- this.inject.service('foo', { as: 'bar' });
- });
-
- test('it works for controllers', function(assert) {
- this.inject.controller('foo');
- this.inject.controller('foo', { as: 'bar' });
- });
-
- test('handles dasherized names', function(assert) {
- this.inject.service('foo-bar');
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | FooBar', function(hooks) {
- setupTest(hooks);
-
- test('it exists', function(assert) {
- this.foo = this.owner.lookup('service:foo');
- this.bar = this.owner.lookup('service:foo');
- });
-
- test('it works for controllers', function(assert) {
- this.foo = this.owner.lookup('controller:foo');
- this.bar = this.owner.lookup('controller:foo');
- });
-
- test('handles dasherized names', function(assert) {
- this['foo-bar'] = this.owner.lookup('service:foo-bar');
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("lookup", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:foo', 'Unit | Service | Foo', {
- beforeEach() {
- let service = this.container.lookup('service:thingy');
- }
- });
-
- test('it happens', function() {
- this.container.lookup('service:thingy').doSomething();
- });
-
- moduleFor('service:bar', 'Unit | Service | Bar');
-
- test('it happens again?', function() {
- this.container.lookup('service:thingy').doSomething();
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- let service = this.owner.lookup('service:thingy');
- });
-
- test('it happens', function() {
- this.owner.lookup('service:thingy').doSomething();
- });
- });
-
- module('Unit | Service | Bar', function(hooks) {
- setupTest(hooks);
-
- test('it happens again?', function() {
- this.owner.lookup('service:thingy').doSomething();
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("merge-qunit-imports", () => {
- const INPUT = `
- import { skip } from 'qunit';
- import { moduleFor, test } from 'ember-qunit';
- `;
-
- const OUTPUT = `
- import { module, skip, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("module-for-acceptance", () => {
- const INPUT = `
- import { test } from 'qunit';
- import moduleForAcceptance from '../helpers/module-for-acceptance';
- import { setupTestHelper } from 'setup-test-helper';
-
- moduleForAcceptance('Acceptance | MyRoute', {
- beforeEach() {
- // my comment
- setupTestHelper();
- },
- });
-
- test('it happens', function() {
- visit('my-route');
- andThen(() => {
- assert.equal(currentURL(), 'wat');
- });
- });
-
- moduleForAcceptance('Acceptance | ES5 MyRoute', {
- beforeEach: function() {
- setupTestHelper();
- },
- });
-
- test('it happens with es5 function', function() {
- visit('my-route');
- andThen(() => {
- // visit me
- assert.equal(currentURL(), 'wat');
- assert.equal(currentURL(), 'wat');
- assert.equal(currentRouteName(), 'wat');
- });
- });
-
- moduleForAcceptance('Acceptance | OtherRoute', {
- beforeEach() {},
- });
-
- test('it happens with find', function() {
- visit('my-route');
- blur('#my-input');
- click('#my-block');
- find('#my-block');
- fillIn('#my-input', 'codemod');
- focus('#my-input');
- tap('#my-input');
- triggerEvent('#my-input', 'focusin');
- triggerKeyEvent('#my-input', 'keyup', 13);
- });
-
- moduleForAcceptance('Acceptance | AndThenRoute');
-
- test('it works with andThen', function() {
- visit('my-route');
- andThen(() => {
- assert.ok(true);
- assert.ok(false);
- });
- find('#my-block');
- });
-
- test('it works with es5 andThen', function() {
- visit('my-route');
- andThen(function() {
- assert.ok(true);
- assert.ok(false);
- });
- find('#my-block');
- });
-
- test('it works with nested', function() {
- visit('my-route');
- andThen(function() {
- assert.equal(currenURL(), 'my-route');
- visit('other-route');
- });
- andThen(function() {
- assert.equal(currenURL(), 'other-route');
- });
- });
-
- test('it works with nested andThens', function() {
- visit('my-route');
- andThen(function() {
- assert.equal(currenURL(), 'my-route');
- visit('other-route');
- andThen(function() {
- assert.equal(currenURL(), 'other-route');
- });
- });
- });
-
- test('it works with assert.expect', function() {
- assert.expect(2);
- visit('my-route');
- andThen(function() {
- assert.equal(currenURL(), 'my-route');
- visit('other-route');
- });
- andThen(function() {
- assert.equal(currenURL(), 'other-route');
- });
- });
-
- module(
- 'something',
- {
- beforeEach() {
- console.log('outer beforeEach');
- },
- afterEach() {
- console.log('outer afterEach');
- },
- },
- function() {
- moduleForAcceptance('nested', {
- beforeEach() {
- console.log('nested beforeEach');
- },
- afterEach() {
- console.log('nested afterEach');
- },
- });
-
- test('foo', function(assert) {
- assert.expect(2);
- visit('my-route');
- andThen(function() {
- assert.equal(currenURL(), 'my-route');
- });
- });
- }
- );
-
- module('other thing', function(hooks) {
- hooks.beforeEach(function() {
- console.log('outer beforeEach');
- });
-
- hooks.afterEach(function() {
- console.log('outer afterEach');
- });
-
- moduleForAcceptance('nested', {
- beforeEach() {
- console.log('nested beforeEach');
- },
- afterEach() {
- console.log('nested afterEach');
- },
- });
-
- test('foo', function(assert) {
- assert.expect(2);
- visit('my-route');
- andThen(function() {
- assert.equal(currenURL(), 'my-route');
- });
- });
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupApplicationTest } from 'ember-qunit';
- import { setupTestHelper } from 'setup-test-helper';
-
- module('Acceptance | MyRoute', function(hooks) {
- setupApplicationTest(hooks);
-
- hooks.beforeEach(function() {
- // my comment
- setupTestHelper();
- });
-
- test('it happens', async function() {
- await visit('my-route');
- assert.equal(currentURL(), 'wat');
- });
- });
-
- module('Acceptance | ES5 MyRoute', function(hooks) {
- setupApplicationTest(hooks);
-
- hooks.beforeEach(function() {
- setupTestHelper();
- });
-
- test('it happens with es5 function', async function() {
- await visit('my-route');
- // visit me
- assert.equal(currentURL(), 'wat');
- assert.equal(currentURL(), 'wat');
- assert.equal(currentRouteName(), 'wat');
- });
- });
-
- module('Acceptance | OtherRoute', function(hooks) {
- setupApplicationTest(hooks);
- hooks.beforeEach(function() {});
-
- test('it happens with find', async function() {
- await visit('my-route');
- await blur('#my-input');
- await click('#my-block');
- await find('#my-block');
- await fillIn('#my-input', 'codemod');
- await focus('#my-input');
- await tap('#my-input');
- await triggerEvent('#my-input', 'focusin');
- await triggerKeyEvent('#my-input', 'keyup', 13);
- });
- });
-
- module('Acceptance | AndThenRoute', function(hooks) {
- setupApplicationTest(hooks);
-
- test('it works with andThen', async function() {
- await visit('my-route');
- assert.ok(true);
- assert.ok(false);
- await find('#my-block');
- });
-
- test('it works with es5 andThen', async function() {
- await visit('my-route');
- assert.ok(true);
- assert.ok(false);
- await find('#my-block');
- });
-
- test('it works with nested', async function() {
- await visit('my-route');
- assert.equal(currenURL(), 'my-route');
- await visit('other-route');
- assert.equal(currenURL(), 'other-route');
- });
-
- test('it works with nested andThens', async function() {
- await visit('my-route');
- assert.equal(currenURL(), 'my-route');
- await visit('other-route');
- assert.equal(currenURL(), 'other-route');
- });
-
- test('it works with assert.expect', async function() {
- assert.expect(2);
- await visit('my-route');
- assert.equal(currenURL(), 'my-route');
- await visit('other-route');
- assert.equal(currenURL(), 'other-route');
- });
- });
-
- module('something', function(hooks) {
- hooks.beforeEach(function() {
- console.log('outer beforeEach');
- });
-
- hooks.afterEach(function() {
- console.log('outer afterEach');
- });
-
- module('nested', function(hooks) {
- setupApplicationTest(hooks);
-
- hooks.beforeEach(function() {
- console.log('nested beforeEach');
- });
-
- hooks.afterEach(function() {
- console.log('nested afterEach');
- });
-
- test('foo', async function(assert) {
- assert.expect(2);
- await visit('my-route');
- assert.equal(currenURL(), 'my-route');
- });
- });
- });
-
- module('other thing', function(hooks) {
- hooks.beforeEach(function() {
- console.log('outer beforeEach');
- });
-
- hooks.afterEach(function() {
- console.log('outer afterEach');
- });
-
- module('nested', function(hooks) {
- setupApplicationTest(hooks);
-
- hooks.beforeEach(function() {
- console.log('nested beforeEach');
- });
-
- hooks.afterEach(function() {
- console.log('nested afterEach');
- });
-
- test('foo', async function(assert) {
- assert.expect(2);
- await visit('my-route');
- assert.equal(currenURL(), 'my-route');
- });
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("module-for-arg-combos", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:foo', 'Unit | Service | Foo');
-
- test('it happens', function() {
-
- });
-
- moduleFor('service:foo');
-
- test('it happens', function() {
-
- });
-
- moduleFor('service:foo', { integration: true });
-
- test('it happens', function() {
-
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- test('it happens', function() {
-
- });
- });
-
- module('service:foo', function(hooks) {
- setupTest(hooks);
-
- test('it happens', function() {
-
- });
- });
-
- module('service:foo', function(hooks) {
- setupTest(hooks);
-
- test('it happens', function() {
-
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("module-for-component", () => {
- const INPUT = `
- import { moduleForComponent, test } from 'ember-qunit';
- import wait from 'ember-test-helpers/wait';
- import hbs from 'htmlbars-inline-precompile';
-
- moduleForComponent('foo-bar', 'Integration | Component | FooBar', {
- integration: true
- });
-
- test('it happens', function() {
- this.render(hbs\`derp\`);
- });
-
- test('it happens with comments', function(assert) {
- // comments above this.render are preserved
- this.render(hbs\`derp\`);
-
- assert.equal(this._element.textContent, 'derp');
- });
-
- test('multiple renders', function() {
- this.render(hbs\`lololol\`);
-
- assert.ok(this.$().text(), 'lololol');
-
- this.clearRender();
- this.render(hbs\`other stuff\`);
-
- assert.ok(this.$().text(), 'other stuff');
- });
-
- moduleForComponent('foo-bar', 'Unit | Component | FooBar', {
- needs: [],
- });
-
- test('it happens', function() {
- });
-
- test('it happens again', function() {
- });
-
- moduleForComponent('foo-bar', 'Unit | Component | FooBar', {
- unit: true,
- });
-
- test('it happens', function() {
- });
-
- test('it happens over and over', function() {
- });
-
- moduleForComponent('foo-bar', 'Integration | Component | FooBar', {
- integration: true,
-
- beforeEach() {
- this.render(hbs\`derp\`);
- },
- });
-
- test('can make assertion', function (assert) {
- assert.equal(this._element.textContent, 'derp');
- });
-
- moduleForComponent('foo-bar', 'Integration | Component | FooBar', {
- integration: true,
-
- foo() {
- this.render(hbs\`derp\`);
- },
- });
-
- test('can use render in custom method', function (assert) {
- return wait().then(() => {
- assert.equal(this._element.textContent, 'derp');
- });
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupRenderingTest, setupTest } from 'ember-qunit';
- import { clearRender, render, settled } from '@ember/test-helpers';
- import hbs from 'htmlbars-inline-precompile';
-
- module('Integration | Component | FooBar', function(hooks) {
- setupRenderingTest(hooks);
-
- test('it happens', async function() {
- await render(hbs\`derp\`);
- });
-
- test('it happens with comments', async function(assert) {
- // comments above this.render are preserved
- await render(hbs\`derp\`);
-
- assert.equal(this.element.textContent, 'derp');
- });
-
- test('multiple renders', async function() {
- await render(hbs\`lololol\`);
-
- assert.ok(this.$().text(), 'lololol');
-
- await clearRender();
- await render(hbs\`other stuff\`);
-
- assert.ok(this.$().text(), 'other stuff');
- });
- });
-
- module('Unit | Component | FooBar', function(hooks) {
- setupTest(hooks);
-
- test('it happens', function() {
- });
-
- test('it happens again', function() {
- });
- });
-
- module('Unit | Component | FooBar', function(hooks) {
- setupTest(hooks);
-
- test('it happens', function() {
- });
-
- test('it happens over and over', function() {
- });
- });
-
- module('Integration | Component | FooBar', function(hooks) {
- setupRenderingTest(hooks);
-
- hooks.beforeEach(async function() {
- await render(hbs\`derp\`);
- });
-
- test('can make assertion', function (assert) {
- assert.equal(this.element.textContent, 'derp');
- });
- });
-
- module('Integration | Component | FooBar', function(hooks) {
- setupRenderingTest(hooks);
-
- hooks.beforeEach(function() {
- this.foo = async function() {
- await render(hbs\`derp\`);
- };
- });
-
- test('can use render in custom method', function (assert) {
- return settled().then(() => {
- assert.equal(this.element.textContent, 'derp');
- });
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("module-for-model", () => {
- const INPUT = `
- import {moduleForModel, test} from 'ember-qunit';
-
- moduleForModel('foo', 'Unit | Model | foo');
-
- test('It transforms the subject', function(assert) {
- const model = this.subject();
- });
-
- moduleForModel('foo', 'Unit | Model | Foo', {
- needs: ['serializer:foo']
- });
-
- test('uses store method', function (assert) {
- let store = this.store();
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- import { run } from '@ember/runloop';
-
- module('Unit | Model | foo', function(hooks) {
- setupTest(hooks);
-
- test('It transforms the subject', function(assert) {
- const model = run(() => this.owner.lookup('service:store').createRecord('foo'));
- });
- });
-
- module('Unit | Model | Foo', function(hooks) {
- setupTest(hooks);
-
- test('uses store method', function (assert) {
- let store = this.owner.lookup('service:store');
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("module-for-with-lifecycle-callbacks", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:foo', 'Unit | Service | Foo', {
- beforeEach() {
- doStuff();
- }
- });
-
- test('it happens', function() {
-
- });
-
- moduleFor('service:foo', 'Unit | Service | Foo', {
- after() {
- afterStuff();
- }
- });
-
- test('it happens', function() {
-
- });
-
- moduleFor('service:foo', 'Unit | Service | Foo', {
- // Comments are preserved
- before: function derpy() {
- let foo = 'bar';
- },
-
- beforeEach(assert) {
- assert.ok(true, 'lol');
- },
-
- afterEach() {
- herk = derp;
- },
-
- after() {
- afterStuff();
- }
- });
-
- test('it happens', function() {
-
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- doStuff();
- });
-
- test('it happens', function() {
-
- });
- });
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- hooks.after(function() {
- afterStuff();
- });
-
- test('it happens', function() {
-
- });
- });
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- // Comments are preserved
- hooks.before(function derpy() {
- let foo = 'bar';
- });
-
- hooks.beforeEach(function(assert) {
- assert.ok(true, 'lol');
- });
-
- hooks.afterEach(function() {
- herk = derp;
- });
-
- hooks.after(function() {
- afterStuff();
- });
-
- test('it happens', function() {
-
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("module-with-long-name", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:foo', 'Unit | Service | Foo with a very long name that would cause line breaks');
-
- test('it happens', function() {
-
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | Foo with a very long name that would cause line breaks', function(hooks) {
- setupTest(hooks);
-
- test('it happens', function() {
-
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("multi-module-for", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:foo', 'Unit | Service | Foo');
-
- test('it happens', function() {
-
- });
-
- moduleFor('service:foo', 'Unit | Service | Foo');
-
- test('it happens again?', function() {
-
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- test('it happens', function() {
-
- });
- });
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- test('it happens again?', function() {
-
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("native-qunit-to-nested", () => {
- const INPUT = `
- import { abs } from 'dummy/helpers/abs';
- import { module, test } from 'qunit';
-
- module('Unit | Helper | abs');
-
- test('absolute value works', function(assert) {
- let result;
- result = abs([-1]);
- assert.equal(result, 1);
- result = abs([1]);
- assert.equal(result, 1);
- });
- `;
-
- const OUTPUT = `
- import { abs } from 'dummy/helpers/abs';
- import { module, test } from 'qunit';
-
- module('Unit | Helper | abs', function() {
- test('absolute value works', function(assert) {
- let result;
- result = abs([-1]);
- assert.equal(result, 1);
- result = abs([1]);
- assert.equal(result, 1);
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("nested-module-with-arrow", () => {
- const INPUT = `
- import { module, test } from 'qunit';
- import { setupRenderingTest, setupTest } from 'ember-qunit';
- import { clearRender, render, settled } from '@ember/test-helpers';
- import hbs from 'htmlbars-inline-precompile';
-
- module('Integration | Component | FooBar', hooks => {
- setupRenderingTest(hooks);
-
- test('it happens', async function() {
- await render(hbs\`derp\`);
- });
-
- test('it happens with comments', async function(assert) {
- // comments above this.render are preserved
- await render(hbs\`derp\`);
-
- assert.equal(this.element.textContent, 'derp');
- });
-
- test('multiple renders', async function() {
- await render(hbs\`lololol\`);
-
- assert.ok(this.$().text(), 'lololol');
-
- await clearRender();
- await render(hbs\`other stuff\`);
-
- assert.ok(this.$().text(), 'other stuff');
- });
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupRenderingTest, setupTest } from 'ember-qunit';
- import { clearRender, render, settled } from '@ember/test-helpers';
- import hbs from 'htmlbars-inline-precompile';
-
- module('Integration | Component | FooBar', hooks => {
- setupRenderingTest(hooks);
-
- test('it happens', async function() {
- await render(hbs\`derp\`);
- });
-
- test('it happens with comments', async function(assert) {
- // comments above this.render are preserved
- await render(hbs\`derp\`);
-
- assert.equal(this.element.textContent, 'derp');
- });
-
- test('multiple renders', async function() {
- await render(hbs\`lololol\`);
-
- assert.ok(this.$().text(), 'lololol');
-
- await clearRender();
- await render(hbs\`other stuff\`);
-
- assert.ok(this.$().text(), 'other stuff');
- });
- });
-
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("non-module-ember-qunit-imports", () => {
- const INPUT = `
- import resolver from './helpers/resolver';
- import {
- setResolver
- } from 'ember-qunit';
- import { start } from 'ember-cli-qunit';
-
- setResolver(resolver);
- start();
- `;
-
- const OUTPUT = `
- import resolver from './helpers/resolver';
- import {
- setResolver
- } from 'ember-qunit';
- import { start } from 'ember-cli-qunit';
-
- setResolver(resolver);
- start();
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("non-module-render-usage", () => {
- const INPUT = `
- import someOtherThing from '../foo-bar/';
-
- // this example doesn't use this.render inside of a test block, so it should not be transformed
- // and there should be no new imports added
- someOtherThing(function() {
- this.render('derp');
- });
- `;
-
- const OUTPUT = `
- import someOtherThing from '../foo-bar/';
-
- // this example doesn't use this.render inside of a test block, so it should not be transformed
- // and there should be no new imports added
- someOtherThing(function() {
- this.render('derp');
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("on", () => {
- const INPUT = `
- import { moduleForComponent, test } from 'ember-qunit';
- import hbs from 'htmlbars-inline-precompile';
-
- moduleForComponent('foo-bar', 'Integration | Component | FooBar', {
- integration: true
- });
-
- test('it happens', function(assert) {
- assert.expect(1);
-
- this.on('test', () => assert.ok(true));
- this.render(hbs\`{{test-component test="test"}}\`);
- });
-
- test('it happens non-dotable identifier e.g. [test-foo]', function(assert) {
- assert.expect(1);
-
- this.on('test-foo', () => assert.ok(true));
- this.render(hbs\`{{test-component test="test"}}\`);
- });
-
- moduleForComponent('foo-bar', 'Integration | Component | FooBar', {
- integration: true,
- beforeEach(assert) {
- this.on('test', () => assert.ok(true));
- }
- });
-
- test('it happens', function(assert) {
- assert.expect(1);
-
- this.render(hbs\`{{test-component test="test"}}\`);
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupRenderingTest } from 'ember-qunit';
- import { render } from '@ember/test-helpers';
- import hbs from 'htmlbars-inline-precompile';
-
- module('Integration | Component | FooBar', function(hooks) {
- setupRenderingTest(hooks);
-
- hooks.beforeEach(function() {
- this.actions = {};
- this.send = (actionName, ...args) => this.actions[actionName].apply(this, args);
- });
-
- test('it happens', async function(assert) {
- assert.expect(1);
-
- this.actions.test = () => assert.ok(true);
- await render(hbs\`{{test-component test="test"}}\`);
- });
-
- test('it happens non-dotable identifier e.g. [test-foo]', async function(assert) {
- assert.expect(1);
-
- this.actions['test-foo'] = () => assert.ok(true);
- await render(hbs\`{{test-component test="test"}}\`);
- });
- });
-
- module('Integration | Component | FooBar', function(hooks) {
- setupRenderingTest(hooks);
-
- hooks.beforeEach(function() {
- this.actions = {};
- this.send = (actionName, ...args) => this.actions[actionName].apply(this, args);
- });
-
- hooks.beforeEach(function(assert) {
- this.actions.test = () => assert.ok(true);
- });
-
- test('it happens', async function(assert) {
- assert.expect(1);
-
- await render(hbs\`{{test-component test="test"}}\`);
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("register", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:foo', 'Unit | Service | Foo', {
- beforeEach() {
- this.register('service:thingy', thingy);
- this.registry.register('service:thingy', thingy);
- }
- });
-
- test('it happens', function() {
- this.register('service:thingy', thingy);
- this.registry.register('service:thingy', thingy);
- });
-
- moduleFor('service:bar', 'Unit | Service | Bar');
-
- test('it happens again?', function() {
- this.register('service:thingy', thingy);
- this.registry.register('service:thingy', thingy);
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- this.owner.register('service:thingy', thingy);
- this.owner.register('service:thingy', thingy);
- });
-
- test('it happens', function() {
- this.owner.register('service:thingy', thingy);
- this.owner.register('service:thingy', thingy);
- });
- });
-
- module('Unit | Service | Bar', function(hooks) {
- setupTest(hooks);
-
- test('it happens again?', function() {
- this.owner.register('service:thingy', thingy);
- this.owner.register('service:thingy', thingy);
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("remove-empty-import", () => {
- const INPUT = `
- import { module, test } from 'ember-qunit';
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("resolver", () => {
- const INPUT = `
- import { module } from 'qunit';
- import { moduleFor, moduleForComponent, test } from 'ember-qunit';
- import hbs from 'htmlbars-inline-precompile';
- import engineResolverFor from 'ember-engines/test-support/engine-resolver-for';
-
- const resolver = engineResolverFor('appointments-manager');
-
- moduleForComponent('date-picker', 'Integration | Component | Date picker', {
- integration: true,
- resolver
- });
-
- test('renders text', function(assert) {
- this.render(hbs\`{{date-picker}}\`);
- assert.equal(this.$().text().trim(), 'una fecha');
- });
-
- moduleFor('service:foo', {
- resolver
- });
-
- test('can resolve from custom resolver', function(assert) {
- assert.ok(this.container.lookup('service:foo'));
- });
-
- module('non-ember-qunit module', {
- resolver
- });
-
- test('custom resolver property means nothing, and ends up in \`beforeEach\`', function(assert) {
- assert.ok(this.container.lookup('service:foo'));
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest, setupRenderingTest } from 'ember-qunit';
- import { render } from '@ember/test-helpers';
- import hbs from 'htmlbars-inline-precompile';
- import engineResolverFor from 'ember-engines/test-support/engine-resolver-for';
-
- const resolver = engineResolverFor('appointments-manager');
-
- module('Integration | Component | Date picker', function(hooks) {
- setupRenderingTest(hooks, {
- resolver
- });
-
- test('renders text', async function(assert) {
- await render(hbs\`{{date-picker}}\`);
- assert.equal(this.$().text().trim(), 'una fecha');
- });
- });
-
- module('service:foo', function(hooks) {
- setupTest(hooks, {
- resolver
- });
-
- test('can resolve from custom resolver', function(assert) {
- assert.ok(this.owner.lookup('service:foo'));
- });
- });
-
- module('non-ember-qunit module', function(hooks) {
- hooks.beforeEach(function() {
- this.resolver = resolver;
- });
-
- test('custom resolver property means nothing, and ends up in \`beforeEach\`', function(assert) {
- assert.ok(this.owner.lookup('service:foo'));
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("rewrite-imports", () => {
- const INPUT = `
- import { moduleFor, moduleForComponent, moduleForModel } from 'ember-qunit';
- `;
-
- const OUTPUT = `
- import { module } from 'qunit';
- import { setupTest } from 'ember-qunit';
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("simple-module-for", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:foo', 'Unit | Service | Foo');
-
- test('it happens', function() {
-
- });
-
- test('it happens again', function() {
-
- });
-
- // this one has comments
- test('it happens and again', function() {
-
- });
-
- skip('this is included');
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- test('it happens', function() {
-
- });
-
- test('it happens again', function() {
-
- });
-
- // this one has comments
- test('it happens and again', function() {
-
- });
-
- skip('this is included');
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("subject", () => {
- const INPUT = `
- import { moduleFor, test } from 'ember-qunit';
-
- moduleFor('service:flash', 'Unit | Service | Flash', {
- unit: true
- });
-
- test('should allow messages to be queued', function (assert) {
- let subject = this.subject();
- });
-
- moduleFor('service:non-singleton-service', 'Unit | Service | NonSingletonService', {
- unit: true
- });
-
- test('does something', function (assert) {
- let subject = this.subject({ name: 'James' });
- });
-
- moduleFor('model:foo', 'Unit | Model | Foo', {
- unit: true
- });
-
- test('has some thing', function (assert) {
- let subject = this.subject();
- });
-
- test('has another thing', function (assert) {
- let subject = this.subject({ size: 'big' });
- });
-
- moduleForModel('foo', 'Integration | Model | Foo', {
- integration: true
- });
-
- test('has some thing', function (assert) {
- let subject = this.subject();
- });
-
- moduleForModel('foo', 'Unit | Model | Foo', {
- needs: ['serializer:foo']
- });
-
- test('has some thing', function (assert) {
- let subject = this.subject();
- });
-
- moduleForComponent('foo-bar', 'Unit | Component | FooBar', {
- unit: true,
- });
-
- test('has some thing', function (assert) {
- let subject = this.subject();
- });
-
- test('has another thing', function (assert) {
- let subject = this.subject({ size: 'big' });
- });
-
- moduleFor('service:foo', {
- subject() {
- return derp();
- }
- });
-
- test('can use custom subject', function(assert) {
- let subject = this.subject();
- });
-
- moduleFor('service:foo', 'Unit | Service | Foo', {
- unit: true,
-
- beforeEach() {
- this.service = this.subject();
- }
- });
-
- test('can use service', function (assert) {
- this.service.something();
- });
-
- moduleFor('service:foo');
-
- test('does not require more than one argument', function(assert) {
- let subject = this.subject();
- });
-
- moduleFor('service:foo', {
- integration: true
- });
-
- test('can use subject in moduleFor + integration: true', function(assert) {
- let subject = this.subject();
- });
- `;
-
- const OUTPUT = `
- import { module, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
-
- import { run } from '@ember/runloop';
-
- module('Unit | Service | Flash', function(hooks) {
- setupTest(hooks);
-
- test('should allow messages to be queued', function (assert) {
- let subject = this.owner.lookup('service:flash');
- });
- });
-
- module('Unit | Service | NonSingletonService', function(hooks) {
- setupTest(hooks);
-
- test('does something', function (assert) {
- let subject = this.owner.factoryFor('service:non-singleton-service').create({ name: 'James' });
- });
- });
-
- module('Unit | Model | Foo', function(hooks) {
- setupTest(hooks);
-
- test('has some thing', function (assert) {
- let subject = run(() => this.owner.lookup('service:store').createRecord('foo'));
- });
-
- test('has another thing', function (assert) {
- let subject = run(() => this.owner.lookup('service:store').createRecord('foo', { size: 'big' }));
- });
- });
-
- module('Integration | Model | Foo', function(hooks) {
- setupTest(hooks);
-
- test('has some thing', function (assert) {
- let subject = run(() => this.owner.lookup('service:store').createRecord('foo'));
- });
- });
-
- module('Unit | Model | Foo', function(hooks) {
- setupTest(hooks);
-
- test('has some thing', function (assert) {
- let subject = run(() => this.owner.lookup('service:store').createRecord('foo'));
- });
- });
-
- module('Unit | Component | FooBar', function(hooks) {
- setupTest(hooks);
-
- test('has some thing', function (assert) {
- let subject = this.owner.factoryFor('component:foo-bar').create();
- });
-
- test('has another thing', function (assert) {
- let subject = this.owner.factoryFor('component:foo-bar').create({ size: 'big' });
- });
- });
-
- module('service:foo', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- this.subject = function() {
- return derp();
- };
- });
-
- test('can use custom subject', function(assert) {
- let subject = this.subject();
- });
- });
-
- module('Unit | Service | Foo', function(hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function() {
- this.service = this.owner.lookup('service:foo');
- });
-
- test('can use service', function (assert) {
- this.service.something();
- });
- });
-
- module('service:foo', function(hooks) {
- setupTest(hooks);
-
- test('does not require more than one argument', function(assert) {
- let subject = this.owner.lookup('service:foo');
- });
- });
-
- module('service:foo', function(hooks) {
- setupTest(hooks);
-
- test('can use subject in moduleFor + integration: true', function(assert) {
- let subject = this.owner.lookup('service:foo');
- });
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("test-skip-imports", () => {
- const INPUT = `
- import { moduleFor, test, skip } from 'ember-qunit';
- `;
-
- const OUTPUT = `
- import { module, skip, test } from 'qunit';
- import { setupTest } from 'ember-qunit';
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("wait", () => {
- const INPUT = `
- import wait from 'ember-test-helpers/wait';
-
- function stuff() {
- wait().then(() => {
- otherStuff();
- });
- }
- `;
-
- const OUTPUT = `
- import { settled } from '@ember/test-helpers';
-
- function stuff() {
- settled().then(() => {
- otherStuff();
- });
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/convert-module-for-to-setup-test/tsconfig.json b/packages/codemods/ember/5/convert-module-for-to-setup-test/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/convert-module-for-to-setup-test/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/cp-property-map/.codemodrc.json b/packages/codemods/ember/5/cp-property-map/.codemodrc.json
deleted file mode 100644
index c243efd6b..000000000
--- a/packages/codemods/ember/5/cp-property-map/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/cp-property-map",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.9.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/cp-property-map",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/cp-property-map/README.md b/packages/codemods/ember/5/cp-property-map/README.md
deleted file mode 100644
index 2823a005e..000000000
--- a/packages/codemods/ember/5/cp-property-map/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-`.property()` is a modifier that adds additional property dependencies to an existing computed property. For `filter`, `map`, and `sort` computed property macros, this codemod ensures they receive an array of additional dependent keys as a second parameter.
-
-## Before
-
-```jsx
-const Person = EmberObject.extend({
- friendNames: map('friends', function (friend) {
- return friend[this.get('nameKey')];
- }).property('nameKey'),
-});
-```
-
-## After
-
-```tsx
-const Person = EmberObject.extend({
- friendNames: map('friends', ['nameKey'], function (friend) {
- return friend[this.get('nameKey')];
- }),
-});
-```
\ No newline at end of file
diff --git a/packages/codemods/ember/5/cp-property-map/package.json b/packages/codemods/ember/5/cp-property-map/package.json
deleted file mode 100644
index 04514f99e..000000000
--- a/packages/codemods/ember/5/cp-property-map/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-cp-property-map",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/cp-property-map/src/index.js b/packages/codemods/ember/5/cp-property-map/src/index.js
deleted file mode 100644
index 39746b655..000000000
--- a/packages/codemods/ember/5/cp-property-map/src/index.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/cp-property-map/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- root
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: { callee: { name: "map" } },
- property: { name: "property" },
- },
- })
- .replaceWith((path) => {
- let calleeArgs = path.value.callee.object.arguments;
- let first = calleeArgs.slice(0, calleeArgs.length - 1);
- let last = calleeArgs[calleeArgs.length - 1];
- let args = [].concat(
- first,
- j.arrayExpression(path.value.arguments),
- last,
- );
-
- return j.callExpression(j.identifier("map"), args);
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/cp-property-map/test/test.ts b/packages/codemods/ember/5/cp-property-map/test/test.ts
deleted file mode 100644
index b83cea57c..000000000
--- a/packages/codemods/ember/5/cp-property-map/test/test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 cp-property-map", () => {
- it("basic", () => {
- const INPUT = `
- const Person = EmberObject.extend({
- friendNames: map('friends', function(friend) {
- return friend[this.get('nameKey')];
- }).property('nameKey')
- });
- `;
-
- const OUTPUT = `
- const Person = EmberObject.extend({
- friendNames: map('friends', ['nameKey'], function(friend) {
- return friend[this.get('nameKey')];
- })
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/cp-property-map/tsconfig.json b/packages/codemods/ember/5/cp-property-map/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/cp-property-map/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/cp-property/.codemodrc.json b/packages/codemods/ember/5/cp-property/.codemodrc.json
deleted file mode 100644
index 9aaf578d8..000000000
--- a/packages/codemods/ember/5/cp-property/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/cp-property",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.9.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/cp-property",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/cp-property/README.md b/packages/codemods/ember/5/cp-property/README.md
deleted file mode 100644
index ba9bdea75..000000000
--- a/packages/codemods/ember/5/cp-property/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-`.property()` is a modifier that adds additional property dependencies to an existing computed property. This codemod moves the dependencies to the main computed property definition.
-
-## Before
-
-```jsx
-const Person = EmberObject.extend({
- fullName: computed(function () {
- return `${this.firstName} ${this.lastName}`;
- }).property('firstName', 'lastName'),
-});
-```
-
-## After
-
-```tsx
-const Person = EmberObject.extend({
- fullName: computed('firstName', 'lastName', function () {
- return `${this.firstName} ${this.lastName}`;
- }),
-});
-```
diff --git a/packages/codemods/ember/5/cp-property/package.json b/packages/codemods/ember/5/cp-property/package.json
deleted file mode 100644
index 6a191af0b..000000000
--- a/packages/codemods/ember/5/cp-property/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-cp-property",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/cp-property/src/index.js b/packages/codemods/ember/5/cp-property/src/index.js
deleted file mode 100644
index e632fcea3..000000000
--- a/packages/codemods/ember/5/cp-property/src/index.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/cp-property/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- root
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: { callee: { name: "computed" } },
- property: { name: "property" },
- },
- })
- //.forEach(p => console.log(p))
- .replaceWith((path) => {
- let args = [...path.value.arguments].concat(
- path.value.callee.object.arguments,
- );
- return j.callExpression(j.identifier("computed"), args);
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/cp-property/test/test.ts b/packages/codemods/ember/5/cp-property/test/test.ts
deleted file mode 100644
index b8a6a0730..000000000
--- a/packages/codemods/ember/5/cp-property/test/test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 cp-property", () => {
- it("basic", () => {
- const INPUT = `
- const Person = EmberObject.extend({
- fullName: computed(function() {
- return \`\${this.firstName} \${this.lastName}\`;
- }).property('firstName', 'lastName')
- });
- `;
-
- const OUTPUT = `
- const Person = EmberObject.extend({
- fullName: computed('firstName', 'lastName', function() {
- return \`\${this.firstName} \${this.lastName}\`;
- })
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/cp-property/tsconfig.json b/packages/codemods/ember/5/cp-property/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/cp-property/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/cp-volatile/.codemodrc.json b/packages/codemods/ember/5/cp-volatile/.codemodrc.json
deleted file mode 100644
index 2add7753a..000000000
--- a/packages/codemods/ember/5/cp-volatile/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/cp-volatile",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.9.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/cp-volatile",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/cp-volatile/README.md b/packages/codemods/ember/5/cp-volatile/README.md
deleted file mode 100644
index 5209be6e8..000000000
--- a/packages/codemods/ember/5/cp-volatile/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-This codemod removes all calls to `volatile()` and ensures that native getters are directly used.
-
-## Before
-
-```jsx
-const Person = EmberObject.extend({
- fullName: computed(function () {
- return `${this.firstName} ${this.lastName}`;
- }).volatile(),
-});
-```
-
-## After
-
-```tsx
-const Person = EmberObject.extend({
- get fullName() {
- return `${this.firstName} ${this.lastName}`;
- },
-});
-```
\ No newline at end of file
diff --git a/packages/codemods/ember/5/cp-volatile/package.json b/packages/codemods/ember/5/cp-volatile/package.json
deleted file mode 100644
index d192f8f7d..000000000
--- a/packages/codemods/ember/5/cp-volatile/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-cp-volatile",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/cp-volatile/src/index.js b/packages/codemods/ember/5/cp-volatile/src/index.js
deleted file mode 100644
index 66e70399b..000000000
--- a/packages/codemods/ember/5/cp-volatile/src/index.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/cp-volatile/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
- */
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- root
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: { callee: { name: "computed" } },
- property: { name: "volatile" },
- },
- })
- //.forEach(p => console.log(p.value.callee.object.arguments[0].body))
- .map((p) => p.parentPath)
- .replaceWith((path) => {
- // Find the function expression in the arguments
- const fnExp = path.value.value.callee.object.arguments.find(
- (a) => a.type === "FunctionExpression",
- );
- const fnBody = fnExp.body;
- return j.property(
- "get",
- j.identifier(path.value.key.name),
- j.functionExpression(
- j.identifier(path.value.key.name),
- [],
- fnBody,
- false,
- false,
- ),
- );
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/cp-volatile/test/test.ts b/packages/codemods/ember/5/cp-volatile/test/test.ts
deleted file mode 100644
index b12e7cc81..000000000
--- a/packages/codemods/ember/5/cp-volatile/test/test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 cp-volatile", () => {
- it("basic", () => {
- const INPUT = `
- const Person = EmberObject.extend({
- fullName: computed(function() {
- return \`\${this.firstName} \${this.lastName}\`;
- }).volatile()
- });
- `;
-
- const OUTPUT = `
- const Person = EmberObject.extend({
- get fullName() {
- return \`\${this.firstName} \${this.lastName}\`;
- }
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/cp-volatile/tsconfig.json b/packages/codemods/ember/5/cp-volatile/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/cp-volatile/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/deprecate-merge/.codemodrc.json b/packages/codemods/ember/5/deprecate-merge/.codemodrc.json
deleted file mode 100644
index cf6ecba09..000000000
--- a/packages/codemods/ember/5/deprecate-merge/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/deprecate-merge",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.6.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/deprecate-merge",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/deprecate-merge/README.md b/packages/codemods/ember/5/deprecate-merge/README.md
deleted file mode 100644
index 5fdd0aa1c..000000000
--- a/packages/codemods/ember/5/deprecate-merge/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-This codemod replaces all calls to `Ember.merge` with `Ember.assign`.
-
-## Before
-
-```jsx
-import { merge } from '@ember/polyfills';
-
-var a = { first: 'Yehuda' };
-var b = { last: 'Katz' };
-merge(a, b);
-```
-
-## After
-
-```tsx
-import { assign } from '@ember/polyfills';
-
-var a = { first: 'Yehuda' };
-var b = { last: 'Katz' };
-assign(a, b);
-```
\ No newline at end of file
diff --git a/packages/codemods/ember/5/deprecate-merge/package.json b/packages/codemods/ember/5/deprecate-merge/package.json
deleted file mode 100644
index 2065e2011..000000000
--- a/packages/codemods/ember/5/deprecate-merge/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-deprecate-merge",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/deprecate-merge/src/index.js b/packages/codemods/ember/5/deprecate-merge/src/index.js
deleted file mode 100644
index 3486d46b9..000000000
--- a/packages/codemods/ember/5/deprecate-merge/src/index.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/deprecate-merge/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
- const root = j(file.source);
-
- root
- .find(j.CallExpression, {
- callee: {
- name: "merge",
- },
- })
- .forEach((path) => {
- path.value.callee.name = "assign";
- });
-
- root
- .find(j.ImportDeclaration, {
- specifiers: [{ local: { name: "merge" } }],
- })
- .forEach((i) => {
- i.value.specifiers
- .filter((s) => {
- return s.local.name === "merge";
- })
- .forEach((t) => {
- t.local.name = "assign";
- });
- });
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/deprecate-merge/test/test.ts b/packages/codemods/ember/5/deprecate-merge/test/test.ts
deleted file mode 100644
index 6625e681b..000000000
--- a/packages/codemods/ember/5/deprecate-merge/test/test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 deprecate-merge", () => {
- it("basic", () => {
- const INPUT = `
- import { merge } from '@ember/polyfills';
-
- var a = { first: 'Yehuda' };
- var b = { last: 'Katz' };
- merge(a, b);
- `;
-
- const OUTPUT = `
- import { assign } from '@ember/polyfills';
-
- var a = { first: 'Yehuda' };
- var b = { last: 'Katz' };
- assign(a, b);
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/deprecate-merge/tsconfig.json b/packages/codemods/ember/5/deprecate-merge/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/deprecate-merge/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/deprecate-router-events/.codemodrc.json b/packages/codemods/ember/5/deprecate-router-events/.codemodrc.json
deleted file mode 100644
index 6e82986cb..000000000
--- a/packages/codemods/ember/5/deprecate-router-events/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/deprecate-router-events",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.6.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/deprecate-router-events",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/deprecate-router-events/README.md b/packages/codemods/ember/5/deprecate-router-events/README.md
deleted file mode 100644
index fff138f7e..000000000
--- a/packages/codemods/ember/5/deprecate-router-events/README.md
+++ /dev/null
@@ -1,55 +0,0 @@
-This codemod removes all calls to `willTransition` or `didTransition` events on the Router via usage of `routeWillChange` event listener and `routeDidChange` event listener.
-
-## Before
-
-```jsx
-import Router from '@ember/routing/router';
-import { inject as service } from '@ember/service';
-
-export default Router.extend({
- currentUser: service('current-user'),
-
- willTransition(transition) {
- this._super(...arguments);
- if (!this.currentUser.isLoggedIn) {
- transition.abort();
- this.transitionTo('login');
- }
- },
-
- didTransition(privateInfos) {
- this._super(...arguments);
- ga.send('pageView', {
- pageName: privateInfos.name,
- });
- },
-});
-```
-
-## After
-
-```tsx
-import Router from '@ember/routing/router';
-import { inject as service } from '@ember/service';
-
-export default Router.extend({
- currentUser: service('current-user'),
-
- init() {
- this._super(...arguments);
-
- this.on('routeWillChange', (transition) => {
- if (!this.currentUser.isLoggedIn) {
- transition.abort();
- this.transitionTo('login');
- }
- });
-
- this.on('routeDidChange', (transition) => {
- ga.send('pageView', {
- pageName: privateInfos.name,
- });
- });
- },
-});
-```
diff --git a/packages/codemods/ember/5/deprecate-router-events/package.json b/packages/codemods/ember/5/deprecate-router-events/package.json
deleted file mode 100644
index 79e1f714f..000000000
--- a/packages/codemods/ember/5/deprecate-router-events/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-deprecate-router-events",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/deprecate-router-events/src/index.js b/packages/codemods/ember/5/deprecate-router-events/src/index.js
deleted file mode 100644
index 13535cd57..000000000
--- a/packages/codemods/ember/5/deprecate-router-events/src/index.js
+++ /dev/null
@@ -1,147 +0,0 @@
-/*! @license
-
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/deprecate-router-events/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- const createInit = (props, exp1, exp2) => {
- // First create the super call for init
- let superCall = j.expressionStatement(
- j.callExpression(
- j.memberExpression(j.thisExpression(), j.identifier("_super"), false),
- [j.identifier("...arguments")],
- ),
- );
-
- let initProp = j.objectMethod(
- "method",
- j.identifier("init"),
- [],
- j.blockStatement([superCall, exp1, exp2]),
- );
-
- props.push(initProp);
- };
-
- root
- .find(j.ExportDefaultDeclaration, {
- declaration: {
- callee: {
- object: {
- name: "Router",
- },
- },
- },
- })
- .forEach((path) => {
- let args = path.value.declaration.arguments[0];
- let props = args.properties;
-
- let idxWillTransition = props.findIndex(
- (p) => p.key.name === "willTransition",
- );
- let routeWillChange;
-
- if (idxWillTransition >= 0) {
- let wtBody = props[idxWillTransition].value
- ? props[idxWillTransition].value.body.body
- : props[idxWillTransition].body.body;
-
- wtBody.splice(0, 1); // Remove super call
- routeWillChange = j.expressionStatement(
- j.callExpression(
- j.memberExpression(j.thisExpression(), j.identifier("on"), false),
- [
- j.literal("routeWillChange"),
- j.arrowFunctionExpression(
- [j.identifier("transition")],
- j.blockStatement(wtBody),
- false,
- ),
- ],
- ),
- );
-
- // Cleanup
- props.splice(
- props.findIndex((p) => p.key.name === "willTransition"),
- 1,
- );
- }
-
- let idxDidTransition = props.findIndex(
- (p) => p.key.name === "didTransition",
- );
- let routeDidChange;
-
- if (idxDidTransition >= 0) {
- let dtBody = props[idxDidTransition].value
- ? props[idxDidTransition].value.body.body
- : props[idxDidTransition].body.body;
-
- dtBody.splice(0, 1); // Remove super call
-
- routeDidChange = j.expressionStatement(
- j.callExpression(
- j.memberExpression(j.thisExpression(), j.identifier("on"), false),
- [
- j.literal("routeDidChange"),
- j.arrowFunctionExpression(
- [j.identifier("transition")],
- j.blockStatement(dtBody),
- false,
- ),
- ],
- ),
- );
-
- // Cleanup
- props.splice(
- props.findIndex((p) => p.key.name === "didTransition"),
- 1,
- );
- }
-
- let initFn = props.filter((p) => {
- return p.key.name === "init";
- })[0];
-
- if (initFn) {
- let initFnBody = initFn.body.body;
- initFnBody.push(routeWillChange, routeDidChange);
- } else {
- // We don't have an init() , hence create one
-
- createInit(props, routeWillChange, routeDidChange);
- }
- });
-
- return root.toSource({ quote: "single" });
-}
diff --git a/packages/codemods/ember/5/deprecate-router-events/test/test.ts b/packages/codemods/ember/5/deprecate-router-events/test/test.ts
deleted file mode 100644
index 9b2a6854f..000000000
--- a/packages/codemods/ember/5/deprecate-router-events/test/test.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 deprecate-router-events", () => {
- it("basic", () => {
- const INPUT = `
- import Router from '@ember/routing/router';
- import { inject as service } from '@ember/service';
-
- export default Router.extend({
- currentUser: service('current-user'),
-
- willTransition(transition) {
- this._super(...arguments);
- if (!this.currentUser.isLoggedIn) {
- transition.abort();
- this.transitionTo('login');
- }
- },
-
- didTransition(privateInfos) {
- this._super(...arguments);
- ga.send('pageView', {
- pageName: privateInfos.name
- });
- }
- });
- `;
-
- const OUTPUT = `
- import Router from '@ember/routing/router';
- import { inject as service } from '@ember/service';
-
- export default Router.extend({
- currentUser: service('current-user'),
-
- init() {
- this._super(...arguments);
-
- this.on("routeWillChange", transition => {
- if (!this.currentUser.isLoggedIn) {
- transition.abort();
- this.transitionTo('login');
- }
- });
-
- this.on("routeDidChange", transition => {
- ga.send('pageView', {
- pageName: privateInfos.name
- });
- });
- }
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/deprecate-router-events/tsconfig.json b/packages/codemods/ember/5/deprecate-router-events/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/deprecate-router-events/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/ember-jquery-legacy/.codemodrc.json b/packages/codemods/ember/5/ember-jquery-legacy/.codemodrc.json
deleted file mode 100644
index bb7238026..000000000
--- a/packages/codemods/ember/5/ember-jquery-legacy/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/ember-jquery-legacy",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.3.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/ember-jquery-legacy",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/ember-jquery-legacy/README.md b/packages/codemods/ember/5/ember-jquery-legacy/README.md
deleted file mode 100644
index 8e08382f3..000000000
--- a/packages/codemods/ember/5/ember-jquery-legacy/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-Using event object APIs that are specific to `jQuery.Event`, such as `originalEvent`, is deprecated in Ember.js v3.3. This codemod ensures the access to the native event without triggering any deprecations via wrapping the `event` with the `normalizeEvent` function provided by `ember-jquery-legacy`.
-
-## Before
-
-```jsx
-export default Component.extend({
- click(event) {
- let nativeEvent = event.originalEvent;
- },
-});
-```
-
-## After
-
-```tsx
-import { normalizeEvent } from 'ember-jquery-legacy';
-
-export default Component.extend({
- click(event) {
- let nativeEvent = normalizeEvent(event);
- },
-});
-```
diff --git a/packages/codemods/ember/5/ember-jquery-legacy/package.json b/packages/codemods/ember/5/ember-jquery-legacy/package.json
deleted file mode 100644
index f78530fe9..000000000
--- a/packages/codemods/ember/5/ember-jquery-legacy/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-ember-jquery-legacy",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/ember-jquery-legacy/src/index.js b/packages/codemods/ember/5/ember-jquery-legacy/src/index.js
deleted file mode 100644
index eab76f6ef..000000000
--- a/packages/codemods/ember/5/ember-jquery-legacy/src/index.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/ember-jquery-legacy/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- root
- .find(j.MemberExpression, {
- object: {
- name: "event",
- },
- property: {
- name: "originalEvent",
- },
- })
- .replaceWith((path) => {
- let computedImport = j.importDeclaration(
- [j.importSpecifier(j.identifier("normalizeEvent"))],
- j.literal("ember-jquery-legacy"),
- );
-
- let body = root.get().value.program.body;
- body.unshift(computedImport);
- return j.callExpression(j.identifier("normalizeEvent"), [
- path.value.object,
- ]);
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/ember-jquery-legacy/test/test.ts b/packages/codemods/ember/5/ember-jquery-legacy/test/test.ts
deleted file mode 100644
index 0cdc48f01..000000000
--- a/packages/codemods/ember/5/ember-jquery-legacy/test/test.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 ember-jquery-legacy", () => {
- it("basic", () => {
- const INPUT = `
- export default Component.extend({
- click(event) {
- let nativeEvent = event.originalEvent;
- }
- });
- `;
-
- const OUTPUT = `
- import { normalizeEvent } from "ember-jquery-legacy";
- export default Component.extend({
- click(event) {
- let nativeEvent = normalizeEvent(event);
- }
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/ember-jquery-legacy/tsconfig.json b/packages/codemods/ember/5/ember-jquery-legacy/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/ember-jquery-legacy/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/es5-getter-ember-codemod/.codemodrc.json b/packages/codemods/ember/5/es5-getter-ember-codemod/.codemodrc.json
deleted file mode 100644
index 15b4016c9..000000000
--- a/packages/codemods/ember/5/es5-getter-ember-codemod/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/es5-getter-ember-codemod",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.1.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/es5-getter-ember-codemod",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/es5-getter-ember-codemod/README.md b/packages/codemods/ember/5/es5-getter-ember-codemod/README.md
deleted file mode 100644
index 64a54a87a..000000000
--- a/packages/codemods/ember/5/es5-getter-ember-codemod/README.md
+++ /dev/null
@@ -1,45 +0,0 @@
-This codemod transforms `get()` to `getProperties()` to use traditional object dot notation. This standard was proposed by Ember.js team in https://github.com/emberjs/rfcs/blob/master/text/0281-es5-getters.md.
-
-## Before
-
-```jsx
-let chancancode = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
-chancancode.get('fullName');
-
-let model = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
-model.get('fullName');
-
-let route = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
-route.get('fullName');
-
-let controller = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
-controller.get('fullName');
-controller.get('foo.bar');
-controller.get('foo-bar');
-```
-
-## After
-
-```tsx
-let chancancode = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
-chancancode.get('fullName');
-
-let model = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
-model.get('fullName');
-
-let route = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
-route.fullName;
-
-let controller = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
-controller.fullName;
-controller.get('foo.bar');
-controller['foo-bar'];
-```
diff --git a/packages/codemods/ember/5/es5-getter-ember-codemod/package.json b/packages/codemods/ember/5/es5-getter-ember-codemod/package.json
deleted file mode 100644
index 780fa12d3..000000000
--- a/packages/codemods/ember/5/es5-getter-ember-codemod/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-es5-getter-ember-codemod",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/es5-getter-ember-codemod/src/index.js b/packages/codemods/ember/5/es5-getter-ember-codemod/src/index.js
deleted file mode 100644
index c9358d0e4..000000000
--- a/packages/codemods/ember/5/es5-getter-ember-codemod/src/index.js
+++ /dev/null
@@ -1,208 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/es5-getter-ember-codemod/tree/master/transforms/es5-getter-ember-codemod
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-function isValidIdentifier(identifier) {
- // eslint-disable-next-line no-misleading-character-class
- return /^(?!(?:do|if|in|for|let|new|try|var|case|else|enum|eval|null|this|true|void|with|break|catch|class|const|false|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$)(?:[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC])(?:[\$0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC])*$/.test(
- identifier,
- );
-}
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
- const root = j(file.source);
-
- function isNestedKey(key) {
- return key.indexOf(".") !== -1;
- }
-
- function performReplacement(path, keyIndex, object) {
- let keyNode = path.node.arguments[keyIndex];
-
- if (keyNode.type !== "StringLiteral" && keyNode.type !== "Literal") {
- return;
- }
-
- if (typeof keyNode.value !== "string" || isNestedKey(keyNode.value)) {
- return;
- }
-
- let replacement = isValidIdentifier(keyNode.value)
- ? j.memberExpression(object, j.identifier(keyNode.value))
- : j.memberExpression(object, keyNode, true);
-
- path.replace(replacement);
- }
-
- function transformThisExpression() {
- return root
- .find(j.CallExpression, {
- callee: {
- object: {
- type: "ThisExpression",
- },
- property: {
- name: "get",
- },
- },
- })
- .filter(({ node: { arguments: args } }) => {
- // mirage or pretender stubs pass multiple arguments to
- // this.get, so we restrict transformation to get invocations
- // that provide only 1 argument
- return args.length === 1;
- })
- .forEach((path) => performReplacement(path, 0, j.thisExpression()));
- }
-
- function transformGetOnObject(typicalEmberAssignment) {
- typicalEmberAssignment = typicalEmberAssignment || "model";
-
- return root
- .find(j.CallExpression, {
- callee: {
- object: {
- name: typicalEmberAssignment,
- },
- property: {
- name: "get",
- },
- },
- })
- .forEach((path) => performReplacement(path, 0, path.node.callee.object));
- }
-
- function transformGetPropertiesOnObject() {
- return root
- .find(j.CallExpression, {
- callee: {
- property: {
- name: "getProperties",
- },
- },
- })
- .filter((path) => {
- // check that this is part of a destructuring operation
- if (
- path.parentPath.node.type !== "VariableDeclarator" ||
- path.parentPath.node.id.type !== "ObjectPattern"
- ) {
- return false;
- }
-
- // check that there are no "deep" paths (e.g. "foo.bar")
- if (
- path.node.arguments.length === 1 &&
- path.node.arguments[0].type === "ArrayExpression"
- ) {
- return path.node.arguments[0].elements.every(
- (arg) => arg.value.indexOf(".") === -1,
- );
- } else {
- return path.node.arguments.every(
- (arg) => arg.value.indexOf(".") === -1,
- );
- }
- })
- .forEach((path) => {
- path.replace(path.node.callee.object);
- });
- }
-
- function transformStandaloneGet() {
- let hasGetImport = !!j(file.source)
- .find(j.ImportDeclaration, {
- source: {
- value: "@ember/object",
- },
- })
- .find(j.ImportSpecifier, {
- local: {
- name: "get",
- },
- }).length;
-
- if (!hasGetImport) {
- return;
- }
-
- return root
- .find(j.CallExpression, {
- callee: {
- name: "get",
- },
- arguments: [j.thisExpression],
- })
- .forEach(function (path) {
- let isNotThisExpression =
- path.node.arguments[0].type !== "ThisExpression";
- if (isNotThisExpression) {
- return;
- }
-
- performReplacement(path, 1, j.thisExpression());
- });
- }
-
- function transformEmberDotGet() {
- return root
- .find(j.CallExpression, {
- callee: {
- object: {
- name: "Ember",
- },
- property: {
- name: "get",
- },
- },
- arguments: [j.thisExpression],
- })
- .forEach(function (path) {
- let isNotThisExpression =
- path.node.arguments[0].type !== "ThisExpression";
- if (isNotThisExpression) {
- return;
- }
-
- performReplacement(path, 1, j.thisExpression());
- });
- }
-
- transformThisExpression();
-
- ["route", "controller"].forEach(function (typicalEmberAssignment) {
- transformGetOnObject(typicalEmberAssignment);
- });
-
- transformGetPropertiesOnObject();
-
- transformStandaloneGet();
-
- transformEmberDotGet();
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/es5-getter-ember-codemod/test/test.ts b/packages/codemods/ember/5/es5-getter-ember-codemod/test/test.ts
deleted file mode 100644
index e27bf0a2c..000000000
--- a/packages/codemods/ember/5/es5-getter-ember-codemod/test/test.ts
+++ /dev/null
@@ -1,699 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 es5-getter-ember-codemod", () => {
- it("does-not-transform-full-path-ts", () => {
- const INPUT = `
- class Thing {
- doesNotTransform() {
- this.get('foo.bar.baz');
-
- let model = Object.create({ foo: { bar: 'baz' } });
-
- model.get('foo.bar');
- }
- }
- `;
-
- const OUTPUT = `
- class Thing {
- doesNotTransform() {
- this.get('foo.bar.baz');
-
- let model = Object.create({ foo: { bar: 'baz' } });
-
- model.get('foo.bar');
- }
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("ts"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("does-not-transform-full-path", () => {
- const INPUT = `
- this.get('foo.bar.baz');
-
- let model = Object.create({foo: { bar: 'baz' }});
-
- model.get('foo.bar');
- `;
-
- const OUTPUT = `
- this.get('foo.bar.baz');
-
- let model = Object.create({foo: { bar: 'baz' }});
-
- model.get('foo.bar');
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("does-not-transform-http-stubs", () => {
- const INPUT = `
- this.get('foo/:id', (schema, { params }) => {
- });
-
- this.get('/some/url', function(req) {
- return req;
- });
- `;
-
- const OUTPUT = `
- this.get('foo/:id', (schema, { params }) => {
- });
-
- this.get('/some/url', function(req) {
- return req;
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("get-on-ember-object-ts", () => {
- const INPUT = `
- class Things {
- objectLookup() {
- let chancancode = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- chancancode.get('fullName');
- }
-
- modelLookup() {
- let model = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- model.get('fullName');
- }
-
- routeLookup() {
- let route = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- route.get('fullName');
- }
-
- controllerLookup() {
- let controller = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- controller.get('fullName');
- controller.get('foo.bar');
- controller.get('foo-bar');
- }
- }
- `;
-
- const OUTPUT = `
- class Things {
- objectLookup() {
- let chancancode = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- chancancode.get('fullName');
- }
-
- modelLookup() {
- let model = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- model.get('fullName');
- }
-
- routeLookup() {
- let route = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- route.fullName;
- }
-
- controllerLookup() {
- let controller = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- controller.fullName;
- controller.get('foo.bar');
- controller['foo-bar'];
- }
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("ts"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("get-on-ember-object", () => {
- const INPUT = `
- let chancancode = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- chancancode.get('fullName');
-
- let model = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- model.get('fullName');
-
- let route = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- route.get('fullName');
-
- let controller = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- controller.get('fullName');
- controller.get('foo.bar');
- controller.get('foo-bar');
- `;
-
- const OUTPUT = `
- let chancancode = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- chancancode.get('fullName');
-
- let model = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- model.get('fullName');
-
- let route = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- route.fullName;
-
- let controller = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
-
- controller.fullName;
- controller.get('foo.bar');
- controller['foo-bar'];
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("get-on-this-expression-ts", () => {
- const INPUT = `
- import Object from '@ember/object';
- import { computed } from '@ember-decorators/object';
-
- class Person extends Object {
- @computed('firstName', 'lastName')
- get fullName() {
- return \`\${this.get('firstName')} \${this.get('lastName')}\`;
- }
-
- invalidIdentifier() {
- return this.get('foo-bar');
- }
-
- numericKey() {
- return this.get(42);
- }
-
- templatedKey() {
- return this.get(\`\${'foo'}\`);
- }
- }
- `;
-
- const OUTPUT = `
- import Object from '@ember/object';
- import { computed } from '@ember-decorators/object';
-
- class Person extends Object {
- @computed('firstName', 'lastName')
- get fullName() {
- return \`\${this.firstName} \${this.lastName}\`;
- }
-
- invalidIdentifier() {
- return this['foo-bar'];
- }
-
- numericKey() {
- return this.get(42);
- }
-
- templatedKey() {
- return this.get(\`\${'foo'}\`);
- }
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("ts"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("get-on-this-expression", () => {
- const INPUT = `
- import Object from '@ember/object';
- import { computed } from '@ember-decorators/object';
-
- class Person extends Object {
- @computed('firstName', 'lastName')
- get fullName() {
- return \`\${this.get('firstName')} \${this.get('lastName')}\`;
- }
-
- invalidIdentifier() {
- return this.get('foo-bar');
- }
-
- numericKey() {
- return this.get(42);
- }
-
- templatedKey() {
- return this.get(\`\${'foo'}\`);
- }
- }
- `;
-
- const OUTPUT = `
- import Object from '@ember/object';
- import { computed } from '@ember-decorators/object';
-
- class Person extends Object {
- @computed('firstName', 'lastName')
- get fullName() {
- return \`\${this.firstName} \${this.lastName}\`;
- }
-
- invalidIdentifier() {
- return this['foo-bar'];
- }
-
- numericKey() {
- return this.get(42);
- }
-
- templatedKey() {
- return this.get(\`\${'foo'}\`);
- }
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("getProperties-on-ember-object-ts", () => {
- const INPUT = `
- class Thing {
- getPropertiesMethod(chancancode) {
- let { firstName, lastName, fullName } = chancancode.getProperties(
- 'firstName',
- 'lastName',
- 'fullName'
- );
-
- Object.assign({}, this.getProperties('firstName', 'lastName', 'fullName'), {
- firstName: 'bob'
- });
- }
-
- thisGetPropertiesMethod() {
- let { firstName, lastName, fullName } = this.getProperties(
- 'firstName',
- 'lastName',
- 'fullName'
- );
-
- Object.assign({}, this.getProperties('firstName', 'lastName', 'fullName'), {
- firstName: 'bob'
- });
- }
- }
- `;
-
- const OUTPUT = `
- class Thing {
- getPropertiesMethod(chancancode) {
- let { firstName, lastName, fullName } = chancancode;
-
- Object.assign({}, this.getProperties('firstName', 'lastName', 'fullName'), {
- firstName: 'bob'
- });
- }
-
- thisGetPropertiesMethod() {
- let { firstName, lastName, fullName } = this;
-
- Object.assign({}, this.getProperties('firstName', 'lastName', 'fullName'), {
- firstName: 'bob'
- });
- }
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("ts"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("getProperties-on-ember-object", () => {
- const INPUT = `
- class Thing {
- getPropertiesMethod(chancancode) {
- let { firstName, lastName, fullName } = chancancode.getProperties(
- 'firstName',
- 'lastName',
- 'fullName'
- );
-
- Object.assign({}, this.getProperties('firstName', 'lastName', 'fullName'), {
- firstName: 'bob'
- });
- }
-
- thisGetPropertiesMethod() {
- let { firstName, lastName, fullName } = this.getProperties(
- 'firstName',
- 'lastName',
- 'fullName'
- );
-
- Object.assign({}, this.getProperties('firstName', 'lastName', 'fullName'), {
- firstName: 'bob'
- });
- }
- }
- `;
-
- const OUTPUT = `
- class Thing {
- getPropertiesMethod(chancancode) {
- let { firstName, lastName, fullName } = chancancode;
-
- Object.assign({}, this.getProperties('firstName', 'lastName', 'fullName'), {
- firstName: 'bob'
- });
- }
-
- thisGetPropertiesMethod() {
- let { firstName, lastName, fullName } = this;
-
- Object.assign({}, this.getProperties('firstName', 'lastName', 'fullName'), {
- firstName: 'bob'
- });
- }
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("standalone-ember-get-ts", () => {
- const INPUT = `
- import Ember from 'ember';
- import { set, get } from '@ember/object'
-
- let foo1 = get(this, 'foo');
- let foo2 = get(this, 'foo.bar');
- let foo3 = get(this, 'foo-bar');
- let foo4 = get(this, 42);
-
- let foo5 = Ember.get(this, 'foo');
- let foo6 = Ember.get(this, 'foo.bar');
- let foo7 = Ember.get(this, 'foo-bar');
- let foo8 = Ember.get(this, \`\${'foo'}.bar\`);
-
- let obj = { bar: 'baz' };
- let bar = get(obj, 'bar');
- `;
-
- const OUTPUT = `
- import Ember from 'ember';
- import { set, get } from '@ember/object'
-
- let foo1 = this.foo;
- let foo2 = get(this, 'foo.bar');
- let foo3 = this['foo-bar'];
- let foo4 = get(this, 42);
-
- let foo5 = this.foo;
- let foo6 = Ember.get(this, 'foo.bar');
- let foo7 = this['foo-bar'];
- let foo8 = Ember.get(this, \`\${'foo'}.bar\`);
-
- let obj = { bar: 'baz' };
- let bar = get(obj, 'bar');
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("ts"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("standalone-ember-get", () => {
- const INPUT = `
- import Ember from 'ember';
- import { set, get } from '@ember/object'
-
- let foo1 = get(this, 'foo');
- let foo2 = get(this, 'foo.bar');
- let foo3 = get(this, 'foo-bar');
- let foo4 = get(this, 42);
-
- let foo5 = Ember.get(this, 'foo');
- let foo6 = Ember.get(this, 'foo.bar');
- let foo7 = Ember.get(this, 'foo-bar');
- let foo8 = Ember.get(this, \`\${'foo'}.bar\`);
-
- let obj = { bar: 'baz' };
- let bar = get(obj, 'bar');
- `;
-
- const OUTPUT = `
- import Ember from 'ember';
- import { set, get } from '@ember/object'
-
- let foo1 = this.foo;
- let foo2 = get(this, 'foo.bar');
- let foo3 = this['foo-bar'];
- let foo4 = get(this, 42);
-
- let foo5 = this.foo;
- let foo6 = Ember.get(this, 'foo.bar');
- let foo7 = this['foo-bar'];
- let foo8 = Ember.get(this, \`\${'foo'}.bar\`);
-
- let obj = { bar: 'baz' };
- let bar = get(obj, 'bar');
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("this-dot-getProperties-ts", () => {
- const INPUT = `
- class Thing {
- thisDotGetPropertiesMethod() {
- let { foo, bar, baz } = this.getProperties('foo', 'bar', 'baz');
- }
-
- nestedGetPropertiesMethod() {
- let { foo, bar, baz } = this.nested.object.getProperties(
- 'foo',
- 'bar',
- 'baz'
- );
- }
-
- thisDotGetPropertiesMethod2() {
- let { foo, barBaz } = this.getProperties('foo', 'bar.baz');
- }
-
- thisDotGetPropertiesMethod3() {
- let foo = this.getProperties('bar', 'baz');
- }
- }
- `;
-
- const OUTPUT = `
- class Thing {
- thisDotGetPropertiesMethod() {
- let { foo, bar, baz } = this;
- }
-
- nestedGetPropertiesMethod() {
- let { foo, bar, baz } = this.nested.object;
- }
-
- thisDotGetPropertiesMethod2() {
- let { foo, barBaz } = this.getProperties('foo', 'bar.baz');
- }
-
- thisDotGetPropertiesMethod3() {
- let foo = this.getProperties('bar', 'baz');
- }
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.ts",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("ts"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("this-dot-getProperties", () => {
- const INPUT = `
- class Thing {
- thisDotGetPropertiesMethod() {
- let { foo, bar, baz } = this.getProperties('foo', 'bar', 'baz');
- }
-
- nestedGetPropertiesMethod() {
- let { foo, bar, baz } = this.nested.object.getProperties(
- 'foo',
- 'bar',
- 'baz'
- );
- }
-
- thisDotGetPropertiesMethod2() {
- let { foo, barBaz } = this.getProperties('foo', 'bar.baz');
- }
-
- thisDotGetPropertiesMethod3() {
- let foo = this.getProperties('bar', 'baz');
- }
- }
- `;
-
- const OUTPUT = `
- class Thing {
- thisDotGetPropertiesMethod() {
- let { foo, bar, baz } = this;
- }
-
- nestedGetPropertiesMethod() {
- let { foo, bar, baz } = this.nested.object;
- }
-
- thisDotGetPropertiesMethod2() {
- let { foo, barBaz } = this.getProperties('foo', 'bar.baz');
- }
-
- thisDotGetPropertiesMethod3() {
- let foo = this.getProperties('bar', 'baz');
- }
- }
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/es5-getter-ember-codemod/tsconfig.json b/packages/codemods/ember/5/es5-getter-ember-codemod/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/es5-getter-ember-codemod/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/fpe-computed/.codemodrc.json b/packages/codemods/ember/5/fpe-computed/.codemodrc.json
deleted file mode 100644
index 2c2074323..000000000
--- a/packages/codemods/ember/5/fpe-computed/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/fpe-computed",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.11.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/fpe-computed",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/fpe-computed/README.md b/packages/codemods/ember/5/fpe-computed/README.md
deleted file mode 100644
index e4e88c809..000000000
--- a/packages/codemods/ember/5/fpe-computed/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-## Before
-
-```jsx
-import EmberObject from '@ember/object';
-
-let Person = EmberObject.extend({
- init() {
- this._super(...arguments);
-
- this.firstName = 'Betty';
- this.lastName = 'Jones';
- },
-
- fullName: function () {
- return `${this.firstName} ${this.lastName}`;
- }.property('firstName', 'lastName'),
-});
-
-let client = Person.create();
-
-client.get('fullName'); // 'Betty Jones'
-
-client.set('lastName', 'Fuller');
-client.get('fullName'); // 'Betty Fuller'
-```
-
-## After
-
-```tsx
-import EmberObject, { computed } from '@ember/object';
-
-let Person = EmberObject.extend({
- init() {
- this._super(...arguments);
-
- this.firstName = 'Betty';
- this.lastName = 'Jones';
- },
-
- fullName: computed('firstName', 'lastName', function () {
- return `${this.firstName} ${this.lastName}`;
- }),
-});
-
-let client = Person.create();
-
-client.get('fullName'); // 'Betty Jones'
-
-client.set('lastName', 'Fuller');
-client.get('fullName'); // 'Betty Fuller'
-```
diff --git a/packages/codemods/ember/5/fpe-computed/package.json b/packages/codemods/ember/5/fpe-computed/package.json
deleted file mode 100644
index 8c4e09b4c..000000000
--- a/packages/codemods/ember/5/fpe-computed/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-fpe-computed",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/fpe-computed/src/index.js b/packages/codemods/ember/5/fpe-computed/src/index.js
deleted file mode 100644
index 85f3f9bd6..000000000
--- a/packages/codemods/ember/5/fpe-computed/src/index.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/fpe-computed/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- let alreadyHasImport = false;
-
- const importDeclaration = root.find(j.ImportDeclaration, {
- source: {
- value: "@ember/object",
- },
- });
-
- const importComputed = importDeclaration.find(j.ImportSpecifier, {
- imported: { name: "computed" },
- });
-
- if (importComputed.size()) alreadyHasImport = true;
-
- root
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: { type: "FunctionExpression" },
- property: { name: "property" },
- },
- })
- .replaceWith((path) => {
- let computedImport = j.importDeclaration(
- [j.importSpecifier(j.identifier("computed"))],
- j.literal("@ember/object"),
- );
-
- if (!alreadyHasImport) {
- let body = root.get().value.program.body;
-
- body.unshift(computedImport);
- alreadyHasImport = true;
- }
-
- return j.callExpression(
- j.identifier("computed"),
- path.value.arguments.concat(path.value.callee.object),
- );
- });
-
- return root.toSource({ quote: "single" });
-}
diff --git a/packages/codemods/ember/5/fpe-computed/test/test.ts b/packages/codemods/ember/5/fpe-computed/test/test.ts
deleted file mode 100644
index 5dbd74d2d..000000000
--- a/packages/codemods/ember/5/fpe-computed/test/test.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 fpe-computed", () => {
- it("basic", () => {
- const INPUT = `
- import EmberObject from '@ember/object';
-
- let Person = EmberObject.extend({
- init() {
- this._super(...arguments);
-
- this.firstName = 'Betty';
- this.lastName = 'Jones';
- },
-
- fullName: function() {
- return \`\${this.firstName} \${this.lastName}\`;
- }.property('firstName', 'lastName')
- });
-
- let client = Person.create();
-
- client.get('fullName'); // 'Betty Jones'
-
- client.set('lastName', 'Fuller');
- client.get('fullName'); // 'Betty Fuller'
- `;
-
- const OUTPUT = `
- import { computed } from '@ember/object';
- import EmberObject from '@ember/object';
-
- let Person = EmberObject.extend({
- init() {
- this._super(...arguments);
-
- this.firstName = 'Betty';
- this.lastName = 'Jones';
- },
-
- fullName: computed('firstName', 'lastName', function() {
- return \`\${this.firstName} \${this.lastName}\`;
- })
- });
-
- let client = Person.create();
-
- client.get('fullName'); // 'Betty Jones'
-
- client.set('lastName', 'Fuller');
- client.get('fullName'); // 'Betty Fuller'
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/fpe-computed/tsconfig.json b/packages/codemods/ember/5/fpe-computed/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/fpe-computed/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/fpe-observes/.codemodrc.json b/packages/codemods/ember/5/fpe-observes/.codemodrc.json
deleted file mode 100644
index 004b85a91..000000000
--- a/packages/codemods/ember/5/fpe-observes/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/fpe-observes",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.11.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/fpe-observes",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/fpe-observes/README.md b/packages/codemods/ember/5/fpe-observes/README.md
deleted file mode 100644
index 6a5e184f6..000000000
--- a/packages/codemods/ember/5/fpe-observes/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## Before
-
-```jsx
-import EmberObject from '@ember/object';
-
-export default EmberObject.extend({
- valueObserver: function () {
- // Executes whenever the "value" property changes
- }.observes('value'),
-});
-```
-
-## After
-
-```tsx
-import EmberObject from '@ember/object';
-
-export default EmberObject.extend({
- valueObserver: observer('value', function () {
- // Executes whenever the "value" property changes
- }),
-});
-```
diff --git a/packages/codemods/ember/5/fpe-observes/package.json b/packages/codemods/ember/5/fpe-observes/package.json
deleted file mode 100644
index 825c9617c..000000000
--- a/packages/codemods/ember/5/fpe-observes/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-fpe-observes",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/fpe-observes/src/index.js b/packages/codemods/ember/5/fpe-observes/src/index.js
deleted file mode 100644
index 84a08b545..000000000
--- a/packages/codemods/ember/5/fpe-observes/src/index.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/fpe-observes/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- root
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- property: { name: "observes" },
- },
- })
- .replaceWith((path) => {
- return j.callExpression(
- j.identifier("observer"),
- path.value.arguments.concat(path.value.callee.object),
- );
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/fpe-observes/test/test.ts b/packages/codemods/ember/5/fpe-observes/test/test.ts
deleted file mode 100644
index 217d4a575..000000000
--- a/packages/codemods/ember/5/fpe-observes/test/test.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 fpe-observes", () => {
- it("basic", () => {
- const INPUT = `
- import EmberObject from '@ember/object';
-
- export default EmberObject.extend({
- valueObserver: function() {
- // Executes whenever the "value" property changes
- }.observes('value')
- });
- `;
-
- const OUTPUT = `
- import EmberObject from '@ember/object';
-
- export default EmberObject.extend({
- valueObserver: observer('value', function() {
- // Executes whenever the "value" property changes
- })
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/fpe-observes/tsconfig.json b/packages/codemods/ember/5/fpe-observes/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/fpe-observes/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/fpe-on/.codemodrc.json b/packages/codemods/ember/5/fpe-on/.codemodrc.json
deleted file mode 100644
index 455d73211..000000000
--- a/packages/codemods/ember/5/fpe-on/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/fpe-on",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.11.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/fpe-on",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/fpe-on/README.md b/packages/codemods/ember/5/fpe-on/README.md
deleted file mode 100644
index d15996390..000000000
--- a/packages/codemods/ember/5/fpe-on/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-## Before
-
-```jsx
-import EmberObject from '@ember/object';
-import { sendEvent } from '@ember/object/events';
-
-let Job = EmberObject.extend({
- logCompleted: function () {
- console.log('Job completed!');
- }.on('completed'),
-});
-
-let job = Job.create();
-
-sendEvent(job, 'completed'); // Logs 'Job completed!'
-```
-
-## After
-
-```tsx
-import EmberObject from '@ember/object';
-import { on } from '@ember/object/evented';
-import { sendEvent } from '@ember/object/events';
-
-let Job = EmberObject.extend({
- logCompleted: on('completed', function () {
- console.log('Job completed!');
- }),
-});
-
-let job = Job.create();
-
-sendEvent(job, 'completed'); // Logs 'Job completed!'
-```
diff --git a/packages/codemods/ember/5/fpe-on/package.json b/packages/codemods/ember/5/fpe-on/package.json
deleted file mode 100644
index 542c545fe..000000000
--- a/packages/codemods/ember/5/fpe-on/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-fpe-on",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/fpe-on/src/index.js b/packages/codemods/ember/5/fpe-on/src/index.js
deleted file mode 100644
index 3a699a4d0..000000000
--- a/packages/codemods/ember/5/fpe-on/src/index.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/fpe-on/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
- */
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- root
- .find(j.CallExpression, {
- callee: {
- type: "MemberExpression",
- object: { type: "FunctionExpression" },
- property: { name: "on" },
- },
- })
- .replaceWith((path) => {
- let onImport = j.importDeclaration(
- [j.importSpecifier(j.identifier("on"))],
- j.literal("@ember/object/evented"),
- );
-
- let body = root.get().value.program.body;
- body.unshift(onImport);
-
- return j.callExpression(
- j.identifier("on"),
- path.value.arguments.concat(path.value.callee.object),
- );
- });
-
- return root.toSource({ quote: "single" });
-}
diff --git a/packages/codemods/ember/5/fpe-on/test/test.ts b/packages/codemods/ember/5/fpe-on/test/test.ts
deleted file mode 100644
index e259bdb1b..000000000
--- a/packages/codemods/ember/5/fpe-on/test/test.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 fpe-on", () => {
- it("basic", () => {
- const INPUT = `
- import EmberObject from '@ember/object';
- import { sendEvent } from '@ember/object/events';
-
- let Job = EmberObject.extend({
- logCompleted: function() {
- console.log('Job completed!');
- }.on('completed')
- });
-
- let job = Job.create();
-
- sendEvent(job, 'completed'); // Logs 'Job completed!'
- `;
-
- const OUTPUT = `
- import { on } from '@ember/object/evented';
- import EmberObject from '@ember/object';
- import { sendEvent } from '@ember/object/events';
-
- let Job = EmberObject.extend({
- logCompleted: on('completed', function() {
- console.log('Job completed!');
- })
- });
-
- let job = Job.create();
-
- sendEvent(job, 'completed'); // Logs 'Job completed!'
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/fpe-on/tsconfig.json b/packages/codemods/ember/5/fpe-on/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/fpe-on/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/jquery-apis/.codemodrc.json b/packages/codemods/ember/5/jquery-apis/.codemodrc.json
deleted file mode 100644
index 8425b5b25..000000000
--- a/packages/codemods/ember/5/jquery-apis/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/jquery-apis",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.9.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/jquery-apis",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/jquery-apis/README.md b/packages/codemods/ember/5/jquery-apis/README.md
deleted file mode 100644
index c0f6d872c..000000000
--- a/packages/codemods/ember/5/jquery-apis/README.md
+++ /dev/null
@@ -1,59 +0,0 @@
-This codemod replaces all calls to `this.$()` inside of an `Ember.Component` with `this.element` property, which provides a reference to a native DOM element.
-
-## Events
-
-### Before:
-
-```jsx
-import Component from '@ember/component';
-
-export default Component.extend({
- waitForAnimation() {
- this.$().on('transitionend', () => this.doSomething());
- },
-});
-```
-
-### After:
-
-```tsx
-import Component from '@ember/component';
-
-export default Component.extend({
- waitForAnimation() {
- this.element.addEventListener('transitionend', () =>
- this.doSomething(),
- );
- },
-});
-```
-
-## Query Selector
-
-### Before:
-
-```jsx
-import Component from '@ember/component';
-
-export default Component.extend({
- waitForAnimation() {
- this.$('.animated').on('transitionend', () => this.doSomething());
- },
-});
-```
-
-### After:
-
-```tsx
-import Component from '@ember/component';
-
-export default Component.extend({
- waitForAnimation() {
- this.element
- .querySelectorAll('.animated')
- .forEach((el) =>
- el.addEventListener('transitionend', () => this.doSomething()),
- );
- },
-});
-```
diff --git a/packages/codemods/ember/5/jquery-apis/package.json b/packages/codemods/ember/5/jquery-apis/package.json
deleted file mode 100644
index 7b1e9f781..000000000
--- a/packages/codemods/ember/5/jquery-apis/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-jquery-apis",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/jquery-apis/src/index.js b/packages/codemods/ember/5/jquery-apis/src/index.js
deleted file mode 100644
index b9d3f594a..000000000
--- a/packages/codemods/ember/5/jquery-apis/src/index.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/jquery-apis/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
- */
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
-
- root
- .find(j.CallExpression, {
- callee: {
- object: {
- callee: {
- object: {
- type: "ThisExpression",
- },
- property: {
- name: "$",
- },
- },
- },
- },
- })
- .forEach(() => {
- //console.log(path);
- })
- .replaceWith((path) => {
- //callee.object.arguments
- //console.log(path.value.callee.object.arguments);
- const isQuerySelector = path.value.callee.object.arguments.length > 0;
- //console.log(isQuerySelector);
- let newCallExp;
- if (isQuerySelector) {
- newCallExp = j.callExpression(
- j.memberExpression(
- j.callExpression(
- j.memberExpression(
- j.memberExpression(
- j.thisExpression(),
- j.identifier("element"),
- false,
- ),
- j.identifier("querySelectorAll"),
- ),
- path.value.callee.object.arguments,
- ),
- j.identifier("forEach"),
- false,
- ),
- [
- j.arrowFunctionExpression(
- [j.identifier("el")],
- j.callExpression(
- j.memberExpression(
- j.identifier("el"),
- j.identifier("addEventListener"),
- false,
- ),
- path.value.arguments,
- ),
- false,
- ),
- ],
- );
- } else {
- newCallExp = j.callExpression(
- j.memberExpression(
- j.memberExpression(
- j.thisExpression(),
- j.identifier("element"),
- false,
- ),
- j.identifier("addEventListener"),
- false,
- ),
- path.value.arguments,
- );
- }
- return newCallExp;
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/jquery-apis/test/test.ts b/packages/codemods/ember/5/jquery-apis/test/test.ts
deleted file mode 100644
index 6ac5cd017..000000000
--- a/packages/codemods/ember/5/jquery-apis/test/test.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 jquery-apis", () => {
- it("Events", () => {
- const INPUT = `
- import Component from '@ember/component';
-
- export default Component.extend({
- waitForAnimation() {
- this.$().on('transitionend', () => this.doSomething());
- }
- });
- `;
-
- const OUTPUT = `
- import Component from '@ember/component';
-
- export default Component.extend({
- waitForAnimation() {
- this.element.addEventListener('transitionend', () => this.doSomething());
- }
- });
- `;
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-
- it("Query Selector", () => {
- const INPUT = `
- import Component from '@ember/component';
-
- export default Component.extend({
- waitForAnimation() {
- this.$('.animated').on('transitionend', () => this.doSomething());
- }
- });
- `;
-
- const OUTPUT = `
- import Component from '@ember/component';
-
- export default Component.extend({
- waitForAnimation() {
- this.element.querySelectorAll('.animated').forEach(el => el.addEventListener('transitionend', () => this.doSomething()));
- }
- });
- `;
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/jquery-apis/tsconfig.json b/packages/codemods/ember/5/jquery-apis/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/jquery-apis/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/jquery-event/.codemodrc.json b/packages/codemods/ember/5/jquery-event/.codemodrc.json
deleted file mode 100644
index 500d06122..000000000
--- a/packages/codemods/ember/5/jquery-event/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/jquery-event",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.3.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/jquery-event",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/jquery-event/README.md b/packages/codemods/ember/5/jquery-event/README.md
deleted file mode 100644
index 116f65daa..000000000
--- a/packages/codemods/ember/5/jquery-event/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-Using event object APIs that are specific to `jQuery.Event`, such as `originalEvent`, is deprecated in Ember.js v3.3. This codemod removes all calls to `originalEvent` in case of accessing properties that work with jQuery events as well as native events.
-
-## Before
-
-```jsx
-// your event handler:
-export default Component.extend({
- click(event) {
- let x = event.originalEvent.clientX;
- },
-});
-```
-
-## After
-
-```tsx
-// your event handler:
-export default Component.extend({
- click(event) {
- let x = event.clientX;
- },
-});
-```
diff --git a/packages/codemods/ember/5/jquery-event/package.json b/packages/codemods/ember/5/jquery-event/package.json
deleted file mode 100644
index c70f9617d..000000000
--- a/packages/codemods/ember/5/jquery-event/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-jquery-event",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/jquery-event/src/index.js b/packages/codemods/ember/5/jquery-event/src/index.js
deleted file mode 100644
index a67fb423d..000000000
--- a/packages/codemods/ember/5/jquery-event/src/index.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*! @license
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/jquery-event/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
-
- const root = j(file.source);
- root
- .find(j.MemberExpression, {
- object: {
- type: "MemberExpression",
- object: {
- name: "event",
- },
- property: {
- name: "originalEvent",
- },
- },
- })
- .replaceWith((path) => {
- return j.memberExpression(
- j.identifier(path.value.object.object.name),
- j.identifier(path.value.property.name),
- false,
- );
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/jquery-event/test/test.ts b/packages/codemods/ember/5/jquery-event/test/test.ts
deleted file mode 100644
index acf90ea58..000000000
--- a/packages/codemods/ember/5/jquery-event/test/test.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 jquery-event", () => {
- it("basic", () => {
- const INPUT = `
- // your event handler:
- export default Component.extend({
- click(event) {
- let x = event.originalEvent.clientX;
- }
- });
- `;
-
- const OUTPUT = `
- // your event handler:
- export default Component.extend({
- click(event) {
- let x = event.clientX;
- }
- });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/jquery-event/tsconfig.json b/packages/codemods/ember/5/jquery-event/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/jquery-event/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/notify-property-change/.codemodrc.json b/packages/codemods/ember/5/notify-property-change/.codemodrc.json
deleted file mode 100644
index a134bfb0d..000000000
--- a/packages/codemods/ember/5/notify-property-change/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/notify-property-change",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.1.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/notify-property-change",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/notify-property-change/README.md b/packages/codemods/ember/5/notify-property-change/README.md
deleted file mode 100644
index f50fe079a..000000000
--- a/packages/codemods/ember/5/notify-property-change/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-This codemod removes all calls to `propertyWillChange` and replaces all calls to `propertyDidChange` with `notifyPropertyChange`.
-
-## Before
-
-```jsx
-Ember.propertyWillChange(object, 'someProperty');
-doStuff(object);
-Ember.propertyDidChange(object, 'someProperty');
-
-object.propertyWillChange('someProperty');
-doStuff(object);
-object.propertyDidChange('someProperty');
-```
-
-## After
-
-```tsx
-doStuff(object);
-Ember.notifyPropertyChange(object, 'someProperty');
-
-doStuff(object);
-object.notifyPropertyChange('someProperty');
-```
diff --git a/packages/codemods/ember/5/notify-property-change/package.json b/packages/codemods/ember/5/notify-property-change/package.json
deleted file mode 100644
index 1741b7f56..000000000
--- a/packages/codemods/ember/5/notify-property-change/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-notify-property-change",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/notify-property-change/src/index.js b/packages/codemods/ember/5/notify-property-change/src/index.js
deleted file mode 100644
index a1d1a5971..000000000
--- a/packages/codemods/ember/5/notify-property-change/src/index.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*! @license
- * This code is based on a public codemod, which is subject to the original license terms.
- * Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/notify-property-change/index.js
- *
- * License:
- MIT License
-
- Copyright (c) 2019 ember-codemods
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- * License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
- */
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
- const root = j(file.source);
-
- root
- .find(j.ExpressionStatement, {
- expression: {
- callee: {
- property: {
- name: "propertyWillChange",
- },
- },
- },
- })
- .forEach((path) => {
- j(path).remove();
- });
-
- root
- .find(j.MemberExpression, {
- property: {
- name: "propertyDidChange",
- },
- })
- .forEach((path) => {
- path.value.property.name = "notifyPropertyChange";
- });
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/notify-property-change/test/test.ts b/packages/codemods/ember/5/notify-property-change/test/test.ts
deleted file mode 100644
index 210025c07..000000000
--- a/packages/codemods/ember/5/notify-property-change/test/test.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 notify-property-change", () => {
- it("basic", () => {
- const INPUT = `
- Ember.propertyWillChange(object, 'someProperty');
- doStuff(object);
- Ember.propertyDidChange(object, 'someProperty');
-
- object.propertyWillChange('someProperty');
- doStuff(object);
- object.propertyDidChange('someProperty');
- `;
-
- const OUTPUT = `
- doStuff(object);
- Ember.notifyPropertyChange(object, 'someProperty');
-
- doStuff(object);
- object.notifyPropertyChange('someProperty');
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/notify-property-change/tsconfig.json b/packages/codemods/ember/5/notify-property-change/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/notify-property-change/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/ember/5/object-new-constructor/.codemodrc.json b/packages/codemods/ember/5/object-new-constructor/.codemodrc.json
deleted file mode 100644
index 773c2c416..000000000
--- a/packages/codemods/ember/5/object-new-constructor/.codemodrc.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "version": "1.0.1",
- "private": false,
- "name": "ember/5/object-new-constructor",
- "engine": "jscodeshift",
- "applicability": {
- "from": [["ember", ">=", "3.6.0"], ["ember", "<", "5.0.0"]]
- },
- "meta": {
- "git": "https://github.com/ember-codemods/ember-3x-codemods/tree/master/transforms/object-new-constructor",
- "tags": ["migration"]
- }
-}
diff --git a/packages/codemods/ember/5/object-new-constructor/README.md b/packages/codemods/ember/5/object-new-constructor/README.md
deleted file mode 100644
index 990f91e82..000000000
--- a/packages/codemods/ember/5/object-new-constructor/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-`new EmberObject()` is deprecated in Ember.js v3.9 in favor of constructing instances of `EmberObject` and its subclasses. This codemod replaces all calls to `new EmberObject()` with `EmberObject.create()` and adds a `constructor` function to classes that extend from `EmberObject` so that the classes no longer extend from `EmberObject`.
-
-## Before
-
-```jsx
-let obj1 = new EmberObject();
-let obj2 = new EmberObject({ prop: 'value' });
-
-const Foo = EmberObject.extend();
-let foo = new Foo({ bar: 123 });
-```
-
-## After
-
-```tsx
-let obj1 = EmberObject.create();
-let obj2 = EmberObject.create({ prop: 'value' });
-
-const Foo = EmberObject.extend();
-let foo = new Foo({ bar: 123 });
-```
diff --git a/packages/codemods/ember/5/object-new-constructor/package.json b/packages/codemods/ember/5/object-new-constructor/package.json
deleted file mode 100644
index 1ab4a50e0..000000000
--- a/packages/codemods/ember/5/object-new-constructor/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "@codemod-com/codemod-ember-5-object-new-constructor",
- "dependencies": {},
- "devDependencies": {
- "@codemod-com/utilities": "workspace:*",
- "typescript": "^5.2.2",
- "ts-node": "^10.9.1",
- "jscodeshift": "^0.15.1",
- "@types/jscodeshift": "^0.11.10",
- "vitest": "^1.0.1",
- "@vitest/coverage-v8": "catalog:"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/ember/5/object-new-constructor/src/index.js b/packages/codemods/ember/5/object-new-constructor/src/index.js
deleted file mode 100644
index 1781695ab..000000000
--- a/packages/codemods/ember/5/object-new-constructor/src/index.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*! @license
-
-This code is based on a public codemod, which is subject to the original license terms.
-Original codemod: https://github.com/ember-codemods/ember-3x-codemods/blob/master/transforms/object-new-constructor/index.js
-
-MIT License
-
-Copyright (c) 2019 ember-codemods
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-License URL: https://github.com/ember-codemods/ember-no-implicit-this-codemod/blob/master/LICENSE
-*/
-
-export default function transform(file, api) {
- const j = api.jscodeshift;
- const root = j(file.source);
-
- root
- .find(j.NewExpression, {
- callee: {
- name: "EmberObject",
- },
- })
- //.forEach(p => console.log(p))
- .replaceWith((path) => {
- return j.callExpression(
- j.memberExpression(
- j.identifier("EmberObject"),
- j.identifier("create"),
- false,
- ),
- path.value.arguments,
- );
- });
-
- return root.toSource();
-}
diff --git a/packages/codemods/ember/5/object-new-constructor/test/test.ts b/packages/codemods/ember/5/object-new-constructor/test/test.ts
deleted file mode 100644
index 0f82c7b1d..000000000
--- a/packages/codemods/ember/5/object-new-constructor/test/test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import assert from "node:assert";
-import { buildApi } from "@codemod-com/utilities";
-import type { FileInfo } from "jscodeshift";
-import { describe, it } from "vitest";
-import transform from "../src/index.js";
-
-describe("ember 5 object-new-constructor", () => {
- it("basic", () => {
- const INPUT = `
- let obj1 = new EmberObject();
- let obj2 = new EmberObject({ prop: 'value' });
-
- const Foo = EmberObject.extend();
- let foo = new Foo({ bar: 123 });
- `;
-
- const OUTPUT = `
- let obj1 = EmberObject.create();
- let obj2 = EmberObject.create({ prop: 'value' });
-
- const Foo = EmberObject.extend();
- let foo = new Foo({ bar: 123 });
- `;
-
- const fileInfo: FileInfo = {
- path: "index.js",
- source: INPUT,
- };
-
- const actualOutput = transform(fileInfo, buildApi("js"));
-
- assert.deepEqual(
- actualOutput?.replace(/\W/gm, ""),
- OUTPUT.replace(/\W/gm, ""),
- );
- });
-});
diff --git a/packages/codemods/ember/5/object-new-constructor/tsconfig.json b/packages/codemods/ember/5/object-new-constructor/tsconfig.json
deleted file mode 100644
index b4ca7ca88..000000000
--- a/packages/codemods/ember/5/object-new-constructor/tsconfig.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/eslint/biome/migrate-rules/.codemodrc.json b/packages/codemods/eslint/biome/migrate-rules/.codemodrc.json
deleted file mode 100644
index 19ddce1df..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/.codemodrc.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "version": "1.0.2",
- "$schema": "https://codemod-utils.s3.us-west-1.amazonaws.com/configuration_schema.json",
- "name": "biome/migrate-rules",
- "private": false,
- "engine": "filemod",
- "applicability": {
- "from": [["eslint", ">=", "0.0.0"], ["prettier", ">=", "0.0.0"]],
- "to": [["biome", "=", "1.5.3"]]
- },
- "arguments": [
- {
- "name": "rules",
- "kind": "string",
- "required": false
- }
- ],
- "deps": ["-eslint", "-prettier", "@biomejs/biome@1.5.3"],
- "meta": {
- "tags": ["migration"],
- "git": "https://github.com/codemod-com/codemod/tree/main/packages/codemods/eslint/biome/migrate-rules"
- }
-}
diff --git a/packages/codemods/eslint/biome/migrate-rules/README.md b/packages/codemods/eslint/biome/migrate-rules/README.md
deleted file mode 100644
index fa39b1d8c..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/README.md
+++ /dev/null
@@ -1,141 +0,0 @@
-This codemod replaces configuration files for ESLint with corresponding biome.json for all the found rules. It also replaces Prettier configuration.
-
-## Note:
-
-This codemod accepts manual user input, which is required to migrate away from eslint. In order to run it properly, run the following command:
-
-```bash
-npx eslint --print-config | codemod eslint/biome/migrate-rules
-```
-
-It's important that you pass these rules to the codemod, because our codemods are limited in access for security purposes and have no access to most node features that could maliciously affect your system.
-
-This codemod requires internet connection.
-
-## Example
-
-### `package.json`
-
-### Before
-
-```json
-{
- "name": "package-name",
- "dependencies": {
- "prettier": "^3.1.0",
- "prettier-plugin-tailwindcss": "^0.5.4",
- "@tanstack/eslint-plugin-query": "^4.29.25",
- "@someorg/prettier-config": "^1.1.1"
- },
- "devDependencies": {
- "eslint-plugin-airbnb": "^10.2.0",
- "eslint": "^10.2.0",
- "eslint-plugin-prettier": "^10.2.0",
- "eslint-config-prettier": "^10.2.0"
- },
- "main": "./dist/index.cjs",
- "scripts": {
- "start": "pnpm run build:cjs && node ./dist/index.cjs",
- "lint:eslint": "eslint . --fix",
- "lint:prettier": "prettier --write ."
- },
- "eslintIgnore": ["ignore-key"],
- "files": [
- "prettier-test-no-replace",
- "README.md",
- ".codemodrc.json",
- "./dist/index.cjs" ],
- "lint-staged": {
- "*.js": "eslint --fix",
- "*.ts": "eslint --fix"
- },
- "type": "module"
-}
-```
-
-### After
-
-```json
-{
- "name": "package-name",
- "dependencies": {},
- "devDependencies": {
- "@biomejs/biome": "1.5.3"
- },
- "main": "./dist/index.cjs",
- "scripts": {
- "start": "pnpm run build:cjs && node ./dist/index.cjs",
- "lint:eslint": "pnpm dlx @biomejs/biome lint . --apply",
- "lint:prettier": "pnpm dlx @biomejs/biome format --write .",
- "NOTE": "You can apply both linter, formatter and import ordering by using https://biomejs.dev/reference/cli/#biome-check",
- "NOTE2": "There is an ongoing work to release prettier-tailwind-plugin alternative: https://biomejs.dev/linter/rules/use-sorted-classes/, https://github.com/biomejs/biome/issues/1274"
- },
- "files": [
- "prettier-test-no-replace",
- "README.md",
- ".codemodrc.json",
- "./dist/index.cjs" ],
- "lint-staged": {
- "*.js": "pnpm dlx @biomejs/biome lint --apply",
- "*.ts": "pnpm dlx @biomejs/biome lint --apply"
- },
- "type": "module"
-}
-```
-
-### `.eslintrc.json`
-
-### Before
-
-```json
-{
- "rules": [...]
-}
-```
-
-### After
-
-`Removed and replaced with corresponding rules in biome.json`
-
-### `.prettierrc`
-
-### Before
-
-```json
-{
- "printWidth": 80
-}
-```
-
-### After
-
-`Removed and replaced with corresponding values in biome.json`
-
-### `biome.json`
-
-```json
-{
- "linter": {
- "ignore": [
- "ignore-key",
- "dist",
- "build",
- "pnpm-lock.yaml",
- "node_modules"
- ],
- "rules": {
- "suspicious": {
- "noDoubleEquals": "warn",
- "noAssignInExpressions": "warn"
- },
- "correctness": {
- "noUnusedVariables": "off"
- }
- }
- },
- "formatter": {
- "ignore": [],
- "indentStyle": "tab"
- }
-}
-```
diff --git a/packages/codemods/eslint/biome/migrate-rules/generate-latest-dts.ts b/packages/codemods/eslint/biome/migrate-rules/generate-latest-dts.ts
deleted file mode 100644
index 7fc288f09..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/generate-latest-dts.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { writeFileSync } from "node:fs";
-import { compile, compileFromFile } from "json-schema-to-typescript";
-
-const biomeLicense = await fetch(
- "https://raw.githubusercontent.com/biomejs/biome/main/LICENSE-MIT",
-)
- .then((res) => res.text())
- .then((text) => text.replace(/\n/g, "\n * "));
-compileFromFile("./node_modules/@biomejs/biome/configuration_schema.json").then(
- (ts) => writeFileSync("types/biome.d.ts", `/**${biomeLicense}\n*/\n${ts}`),
-);
-
-const schemastoreLicense = await fetch(
- "https://raw.githubusercontent.com/SchemaStore/schemastore/master/LICENSE",
-)
- .then((res) => res.text())
- .then((text) => text.replace(/\n/g, "\n * "));
-const schemastoreNotice = await fetch(
- "https://raw.githubusercontent.com/SchemaStore/schemastore/master/NOTICE",
-)
- .then((res) => res.text())
- .then((text) => text.replace(/\n/g, "\n * "));
-
-const eslintSchema: any = await fetch(
- "https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/eslintrc.json",
-).then((res) => res.json());
-compile(eslintSchema, "ESLint").then((ts) =>
- writeFileSync(
- "types/eslint.d.ts",
- `/**${schemastoreLicense}${schemastoreNotice}\n*/\n${ts}`,
- ),
-);
-
-const prettierSchema: any = await fetch(
- "https://github.com/SchemaStore/schemastore/raw/master/src/schemas/json/prettierrc.json",
-).then((res) => res.json());
-compile(prettierSchema, "Prettier").then((ts) =>
- writeFileSync(
- "types/prettier.d.ts",
- `/**${schemastoreLicense}${schemastoreNotice}\n*/\n${ts}`,
- ),
-);
diff --git a/packages/codemods/eslint/biome/migrate-rules/package.json b/packages/codemods/eslint/biome/migrate-rules/package.json
deleted file mode 100644
index 220b421a1..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "@codemod-com/codemod-eslint-to-biome-rules",
- "devDependencies": {
- "@biomejs/biome": "catalog:",
- "@codemod-com/filemod": "workspace:*",
- "@codemod-com/utilities": "workspace:*",
- "@vitest/coverage-v8": "catalog:",
- "json-schema-to-typescript": "catalog:",
- "memfs": "^4.6.0",
- "ts-node": "^10.9.1",
- "typescript": "^5.2.2",
- "valibot": "catalog:",
- "vitest": "^1.0.1"
- },
- "private": true,
- "main": "./dist/index.cjs",
- "scripts": {
- "generate": "tsx generate-latest-dts.ts",
- "test": "vitest run",
- "test:watch": "vitest watch",
- "coverage": "vitest run --coverage"
- },
- "files": ["./README.md", "./.codemodrc.json", "./dist/index.cjs"],
- "type": "module"
-}
diff --git a/packages/codemods/eslint/biome/migrate-rules/src/functions.ts b/packages/codemods/eslint/biome/migrate-rules/src/functions.ts
deleted file mode 100644
index 51365ad4e..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/src/functions.ts
+++ /dev/null
@@ -1,301 +0,0 @@
-import type { DataAPI } from "@codemod-com/filemod";
-import { isNeitherNullNorUndefined } from "@codemod-com/utilities";
-import type { InferInput } from "valibot";
-import type {
- Configuration as BiomeConfig,
- Rules as BiomeLinterRules,
-} from "../types/biome.js";
-import type { OptionsDefinition as PrettierConfig } from "../types/prettier.js";
-import type { packageJsonSchema } from "./schemas.js";
-import type { Dependencies, RuleValue } from "./types.js";
-
-function deepCopy(obj: T): T {
- if (typeof obj !== "object" || obj === null) {
- return obj;
- }
-
- const newObj = (Array.isArray(obj) ? [] : {}) as T;
-
- for (const key in obj) {
- if (Object.hasOwn(obj, key)) {
- newObj[key] = deepCopy(obj[key]);
- }
- }
-
- return newObj as T;
-}
-
-export function replaceKeys(
- obj: Record,
- replacements: Record,
-): Record {
- // Just in case
- if (typeof obj !== "object" || obj === null) {
- return obj;
- }
-
- const newObj = deepCopy(obj);
-
- for (const [pattern, replacement] of Object.entries(replacements)) {
- // Iterate through each key in the object
- for (const key in newObj) {
- if (Object.hasOwn(newObj, key)) {
- // If the value of the key is an object, recursively call the function
- if (typeof newObj[key] === "object" && newObj[key] !== null) {
- // We don't want to modify anything that is not under scripts or lint-staged keys for now
- // as these are the main places where eslint and prettier commands are used most of the time.
- if (!["scripts", "lint-staged"].includes(key)) {
- continue;
- }
- newObj[key] = replaceKeys(
- newObj[key] as Record,
- replacements,
- );
- } else {
- // If the value is not an object, check for the pattern in the string
- if (
- typeof newObj[key] === "string" &&
- (newObj[key] as string).includes(pattern)
- ) {
- // Replace the key with the specified replacement
- newObj[key] = (newObj[key] as string).replace(pattern, replacement);
- }
- }
- }
- }
- }
-
- return newObj;
-}
-
-export function parseIgnoreEntries(content: string): string[] {
- return content
- .split("\n")
- .map((l) => l.trim())
- .filter((v) => !v.startsWith("#") && v.length > 0);
-}
-
-function isRuleValue(value: string): value is RuleValue {
- return ["error", "warn", "off"].includes(value);
-}
-export function eslintToBiomeRuleValue(value: string): RuleValue {
- if (isRuleValue(value)) {
- return value;
- }
-
- if (value === "0") {
- return "off";
- }
-
- if (value === "1") {
- return "warn";
- }
-
- return "error";
-}
-
-export function getPackageManager(
- packageJson: InferInput,
-) {
- const isYarn = (
- packageJson.packageManager ?? JSON.stringify(packageJson.scripts)
- )?.match(/yarn/g);
- if (isYarn) {
- return ["yarn", "yarn dlx"] as const;
- }
-
- const isPnpm = (
- packageJson.packageManager ?? JSON.stringify(packageJson.scripts)
- )?.match(/pnpm/g);
- if (isPnpm) {
- return ["pnpm", "pnpm dlx"] as const;
- }
-
- const isBun = (
- packageJson.packageManager ?? JSON.stringify(packageJson.scripts)
- )?.match(/bun/g);
- if (isBun) {
- return ["bun", "bunx"] as const;
- }
-
- return ["npm", "npx"] as const;
-}
-
-export function clearDependenciesAndAddNotes(
- packageJson: InferInput,
-): InferInput {
- const newObj = deepCopy(packageJson);
-
- if (newObj.eslintConfig) {
- delete newObj.eslintConfig;
- }
-
- if (newObj.eslintIgnore) {
- delete newObj.eslintIgnore;
- }
-
- let depExisted = false;
- let tailwindPluginExisted = false;
-
- if (newObj.dependencies) {
- Object.keys(newObj.dependencies).forEach((dep) => {
- if (dep.includes("eslint") || dep.includes("prettier")) {
- if (dep.includes("tailwindcss")) {
- tailwindPluginExisted = true;
- }
- depExisted = true;
- delete newObj.dependencies?.[dep];
- }
- });
- }
-
- if (newObj.devDependencies) {
- Object.keys(newObj.devDependencies).forEach((dep) => {
- if (dep.includes("eslint") || dep.includes("prettier")) {
- if (dep.includes("tailwindcss")) {
- tailwindPluginExisted = true;
- }
- depExisted = true;
- delete newObj.devDependencies?.[dep];
- }
- });
- }
-
- if (depExisted) {
- newObj.devDependencies = {
- ...newObj.devDependencies,
- "@biomejs/biome": "1.5.3",
- };
-
- if (!newObj.scripts) {
- newObj.scripts = {};
- }
-
- newObj.scripts.NOTE =
- "You can apply both linter, formatter and import ordering by using https://biomejs.dev/reference/cli/#biome-check";
-
- if (tailwindPluginExisted) {
- newObj.scripts.NOTE2 =
- "There is an ongoing work to release prettier-tailwind-plugin alternative: https://biomejs.dev/linter/rules/use-sorted-classes/, https://github.com/biomejs/biome/issues/1274";
- }
- }
-
- return newObj;
-}
-
-export function buildFormatterConfig(
- prettierConfig: PrettierConfig,
- existingFormatterConfig: BiomeConfig["formatter"],
-): BiomeConfig["formatter"] {
- return {
- ...existingFormatterConfig,
- ...(prettierConfig.useTabs && {
- indentStyle: prettierConfig.useTabs ? "tab" : "space",
- }),
- ...(prettierConfig.tabWidth && {
- indentWidth: prettierConfig.tabWidth,
- }),
- ...(prettierConfig.endOfLine && {
- lineEnding:
- prettierConfig.endOfLine === "auto" ? "lf" : prettierConfig.endOfLine,
- }),
- ...(prettierConfig.printWidth && {
- lineWidth: prettierConfig.printWidth,
- }),
- };
-}
-
-export async function buildLinterConfig(
- rules: Record,
- existingLinterConfig: BiomeConfig["linter"],
- api: DataAPI,
-): Promise {
- const { fetch } = api.getDependencies();
-
- // Find corresponding rules based on the state passed and infer other stuff from eslint config
- const markDownUrl =
- "https://raw.githubusercontent.com/biomejs/website/main/src/content/docs/linter/rules-sources.mdx";
- const biomeRules = await fetch(markDownUrl)
- .then((res) => res.text())
- .then((text) => text.split("\n").slice(5));
-
- const newObj = existingLinterConfig ? deepCopy(existingLinterConfig) : {};
-
- for (const [name, value] of Object.entries(rules)) {
- const ruleValue = (Array.isArray(value) ? value.at(0) : value) ?? "error";
- const ruleName = name.split("/").at(-1);
- if (!ruleName) {
- continue;
- }
-
- const ruleIndex = biomeRules.findIndex((rule) =>
- rule.includes(`[${ruleName}]`),
- );
- if (ruleIndex === -1) {
- continue;
- }
-
- let headerName: string | undefined;
- for (let i = ruleIndex; i >= 0; i--) {
- const item = biomeRules[i];
-
- if (item?.startsWith("#")) {
- headerName = item;
- break;
- }
- }
-
- // Shouldn't happen
- if (!headerName) {
- throw new Error("Oops, header not found");
- }
-
- const urlFragment = [
- ...(biomeRules[ruleIndex]?.matchAll(/\((.*?)\)/g) ?? []),
- ]
- .at(1)
- ?.at(1);
-
- const biomePageContent = await fetch(
- `https://biomejs.dev/${urlFragment}`,
- ).then((res) => res.text());
-
- const [, biomeRuleGroup, biomeRuleName] =
- biomePageContent.match(/lint\/(\w+)\/(\w+)/) ?? [];
-
- if (!biomeRuleGroup || !biomeRuleName) {
- continue;
- }
-
- // If key is already present
- if (
- isNeitherNullNorUndefined(
- // @ts-expect-error avoid as keyof casts
- newObj.rules?.[biomeRuleGroup]?.[biomeRuleName],
- )
- ) {
- continue;
- }
-
- const biomeRuleValue: "error" | "warn" | "off" =
- eslintToBiomeRuleValue(ruleValue);
-
- const existingRuleGroupDef =
- newObj.rules?.[biomeRuleGroup as keyof BiomeLinterRules] ?? {};
-
- // 'all', 'off', etc. we don't want to override these
- if (typeof existingRuleGroupDef !== "object") {
- continue;
- }
-
- newObj.rules = {
- ...newObj?.rules,
- [biomeRuleGroup]: {
- ...existingRuleGroupDef,
- [biomeRuleName]: biomeRuleValue,
- },
- };
- }
-
- return newObj;
-}
diff --git a/packages/codemods/eslint/biome/migrate-rules/src/index.ts b/packages/codemods/eslint/biome/migrate-rules/src/index.ts
deleted file mode 100644
index 9b9fbc97c..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/src/index.ts
+++ /dev/null
@@ -1,214 +0,0 @@
-import { sep } from "node:path";
-import type { Filemod } from "@codemod-com/filemod";
-import { isNeitherNullNorUndefined } from "@codemod-com/utilities";
-import { type InferInput, is } from "valibot";
-import type { Configuration as BiomeConfig } from "../types/biome.js";
-import type { JSONSchemaForESLintConfigurationFiles as EslintConfig } from "../types/eslint.js";
-import type { OptionsDefinition as PrettierConfig } from "../types/prettier.js";
-import {
- buildFormatterConfig,
- buildLinterConfig,
- clearDependenciesAndAddNotes,
- getPackageManager,
- parseIgnoreEntries,
- replaceKeys,
-} from "./functions.js";
-import { packageJsonSchema, valibotEslintSchema } from "./schemas.js";
-import type { Dependencies, Options } from "./types.js";
-
-export const repomod: Filemod = {
- includePatterns: [
- "**/package.json",
- "**/{,.}{eslintrc,eslint.config}{,.js,.json,.cjs,.mjs,.yaml,.yml}",
- "**/{,.}{prettierrc,prettier.config}{,.js,.json,.cjs,.mjs,.yaml,.yml}",
- "**/.eslintignore",
- "**/.prettierignore",
- ],
- excludePatterns: ["**/node_modules/**"],
- initializeState: async (options) => {
- if (typeof options.input !== "string") {
- return { config: null };
- }
-
- let eslintConfig: EslintConfig;
- try {
- const json = JSON.parse(options.input);
- if (!is(valibotEslintSchema, json)) {
- return { config: null };
- }
- eslintConfig = json;
- } catch (err) {
- return { config: null };
- }
-
- return { config: eslintConfig };
- },
- handleFile: async (api, path, options) => {
- const fileName = path.split(sep).at(-1);
- const biomePath = api.joinPaths(api.currentWorkingDirectory, "biome.json");
-
- if (fileName === "package.json") {
- return [
- // FIRST (!), update biome.json linter.ignore based on eslintIgnore key
- {
- kind: "upsertFile",
- path,
- options: {
- biomeJsonStringContent: await api.readFile(biomePath),
- },
- },
- // Then, update package.json and remove all eslint-related keys
- {
- kind: "upsertFile",
- path,
- options,
- },
- ];
- }
-
- return [
- {
- kind: "upsertFile",
- path,
- options: {
- biomeJsonStringContent: await api.readFile(biomePath),
- },
- },
- {
- kind: "deleteFile",
- path,
- },
- ];
- },
- handleData: async (
- api,
- path,
- data,
- options: {
- biomeJsonStringContent?: string;
- },
- state,
- ) => {
- const fileName = path.split(sep).at(-1)!;
- const biomePath = api.joinPaths(api.currentWorkingDirectory, "biome.json");
-
- let biomeJsonContent: BiomeConfig;
- try {
- biomeJsonContent = JSON.parse(options.biomeJsonStringContent!);
- } catch (err) {
- biomeJsonContent = {};
- }
-
- if (fileName.includes("ignore")) {
- let key: "linter" | "formatter" = "linter";
- if (fileName.includes("prettier")) {
- key = "formatter";
- }
-
- const filesToIgnore = parseIgnoreEntries(data);
- biomeJsonContent[key] = {
- ...biomeJsonContent[key],
- ignore: [...filesToIgnore, ...(biomeJsonContent[key]?.ignore ?? [])],
- };
-
- return {
- kind: "upsertData",
- data: JSON.stringify(biomeJsonContent),
- path: biomePath,
- };
- }
-
- if (fileName.includes("eslint")) {
- if (!state?.config?.rules) {
- return { kind: "noop" };
- }
-
- biomeJsonContent.linter = await buildLinterConfig(
- state.config.rules,
- biomeJsonContent.linter,
- api,
- );
-
- return {
- kind: "upsertData",
- data: JSON.stringify(biomeJsonContent),
- path: biomePath,
- };
- }
-
- if (fileName.includes("prettier")) {
- let prettierConfig: PrettierConfig;
- try {
- prettierConfig = JSON.parse(data);
- } catch (err) {
- return { kind: "noop" };
- }
-
- biomeJsonContent.formatter = buildFormatterConfig(
- prettierConfig,
- biomeJsonContent.formatter,
- );
-
- return {
- kind: "upsertData",
- data: JSON.stringify(biomeJsonContent),
- path: biomePath,
- };
- }
-
- if (fileName.includes("package.json")) {
- let packageJson: InferInput;
- try {
- const json = JSON.parse(data);
- if (!is(packageJsonSchema, json)) {
- return { kind: "noop" };
- }
- packageJson = json;
- } catch (err) {
- return { kind: "noop" };
- }
-
- // Means that we want to handle the case with eslintIgnore key in package.json here
- if (isNeitherNullNorUndefined(options.biomeJsonStringContent)) {
- if (
- !packageJson.eslintIgnore ||
- !Array.isArray(packageJson.eslintIgnore)
- ) {
- return { kind: "noop" };
- }
-
- biomeJsonContent.linter = {
- ...biomeJsonContent.linter,
- ignore: [
- ...packageJson.eslintIgnore,
- ...(biomeJsonContent.linter?.ignore ?? []),
- ],
- };
-
- return {
- kind: "upsertData",
- data: JSON.stringify(biomeJsonContent),
- path: biomePath,
- };
- }
-
- const [, command] = getPackageManager(packageJson);
-
- packageJson = replaceKeys(packageJson, {
- eslint: `${command} @biomejs/biome lint`,
- "--fix": "--apply",
- prettier: `${command} @biomejs/biome format`,
- });
-
- packageJson = clearDependenciesAndAddNotes(packageJson);
-
- return {
- kind: "upsertData",
- data: JSON.stringify(packageJson),
- path,
- };
- }
-
- return { kind: "noop" };
- },
-};
diff --git a/packages/codemods/eslint/biome/migrate-rules/src/schemas.ts b/packages/codemods/eslint/biome/migrate-rules/src/schemas.ts
deleted file mode 100644
index 5a9b813e8..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/src/schemas.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { any, object, optional, record, string, tuple } from "valibot";
-
-export const valibotEslintSchema = object({
- rules: record(string(), tuple([string()])),
-});
-
-export const packageJsonSchema = object({
- name: optional(string()),
- dependencies: optional(record(string(), string())),
- devDependencies: optional(record(string(), string())),
- scripts: optional(record(string(), string())),
- eslintConfig: optional(any()),
- eslintIgnore: optional(any()),
- packageManager: optional(string()),
-});
diff --git a/packages/codemods/eslint/biome/migrate-rules/src/types.ts b/packages/codemods/eslint/biome/migrate-rules/src/types.ts
deleted file mode 100644
index 971b24f09..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/src/types.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import type { JSONSchemaForESLintConfigurationFiles as ESLintConfig } from "../types/eslint.js";
-
-export type RuleValue = "error" | "warn" | "off";
-
-export type Dependencies = Readonly<{
- fetch: typeof fetch;
-}>;
-
-export type Options = Readonly<{
- config: ESLintConfig | null;
-}>;
diff --git a/packages/codemods/eslint/biome/migrate-rules/test/test.ts b/packages/codemods/eslint/biome/migrate-rules/test/test.ts
deleted file mode 100644
index 5571fa4ec..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/test/test.ts
+++ /dev/null
@@ -1,224 +0,0 @@
-import { deepEqual, ok } from "node:assert";
-import { type API, buildApi, executeFilemod } from "@codemod-com/filemod";
-import { buildPathAPI, buildUnifiedFileSystem } from "@codemod-com/utilities";
-import type { DirectoryJSON } from "memfs";
-import { Volume, createFsFromVolume } from "memfs";
-import { describe, it } from "vitest";
-import { repomod } from "../src/index.js";
-
-const buildInternalAPI = async (json: DirectoryJSON) => {
- const volume = Volume.fromJSON(json);
-
- const fs = createFsFromVolume(volume);
-
- const unifiedFileSystem = buildUnifiedFileSystem(fs);
- const pathApi = buildPathAPI("/");
-
- return buildApi(unifiedFileSystem, () => ({ fetch }), pathApi);
-};
-
-const transform = async (api: API) => {
- return executeFilemod(
- api,
- repomod,
- "/",
- {
- input: JSON.stringify({
- rules: {
- eqeqeq: ["warn", "smart"],
- "no-cond-assign": ["warn", "except-parens"],
- "no-unused-vars": ["off"],
- },
- ignorePatterns: [
- "**/dist/**",
- "**/build/**",
- "pnpm-lock.yaml",
- "**/node_modules/**",
- ],
- }),
- },
- {},
- );
-};
-
-describe("eslint and prettier to biome migration", async () => {
- const packageJsonPath = "/opt/project/package.json";
- const packageJsonConfig = `
- {
- "name": "package-name",
- "dependencies": {
- "prettier": "^3.1.0",
- "prettier-plugin-tailwindcss": "^0.5.4",
- "@tanstack/eslint-plugin-query": "^4.29.25",
- "@someorg/prettier-config": "^1.1.1"
- },
- "devDependencies": {
- "eslint-plugin-airbnb": "^10.2.0",
- "eslint": "^10.2.0",
- "eslint-plugin-prettier": "^10.2.0",
- "eslint-config-prettier": "^10.2.0"
- },
- "main": "./dist/index.cjs",
- "scripts": {
- "start": "pnpm run build:cjs && node ./dist/index.cjs",
- "lint:eslint": "eslint . --fix",
- "lint:prettier": "prettier --write ."
- },
- "eslintIgnore": ["ignore-key"],
- "files": [
- "prettier-test-no-replace",
- "README.md",
- ".codemodrc.json",
- "./dist/index.cjs"
- ],
- "lint-staged": {
- "*.js": "eslint --fix",
- "*.ts": "eslint --fix"
- },
- "type": "module"
- }
- `;
-
- const eslintRcPath = "/opt/project/.eslintrc";
- const eslintIgnorePath = "/opt/project/.eslintignore";
- const eslintIgnoreContent = `
- # config-key: config-value
- dist
- build
- pnpm-lock.yaml
- node_modules
- `;
-
- const prettierRcPath = "/opt/project/.prettierrc";
- const prettierRcContent = `
- {
- "semi": false,
- "useTabs": true,
- "singleQuote": true,
- "trailingComma": "all"
- }
- `;
- const prettierIgnorePath = "/opt/project/.prettierignore";
-
- it("should contain correct file commands", async () => {
- const api = await buildInternalAPI({
- [packageJsonPath]: packageJsonConfig,
- [eslintRcPath]: "",
- [eslintIgnorePath]: eslintIgnoreContent,
- [prettierRcPath]: prettierRcContent,
- [prettierIgnorePath]: "",
- });
- const biomeJsonPath = api.fileAPI.joinPaths(
- api.fileAPI.currentWorkingDirectory,
- "biome.json",
- );
-
- const externalFileCommands = await transform(api);
-
- deepEqual(externalFileCommands.length, 6);
-
- ok(
- externalFileCommands.filter(
- (command) =>
- (command.kind === "upsertFile" && command.path === packageJsonPath) ||
- (command.kind === "deleteFile" && command.path === eslintRcPath) ||
- (command.kind === "deleteFile" &&
- command.path === eslintIgnorePath) ||
- (command.kind === "deleteFile" && command.path === prettierRcPath) ||
- (command.kind === "deleteFile" &&
- command.path === prettierIgnorePath) ||
- (command.kind === "upsertFile" && command.path === biomeJsonPath),
- ).length === externalFileCommands.length,
- );
- });
-
- it("should correctly modify package.json and create proper biome.json", async () => {
- const api = await buildInternalAPI({
- [packageJsonPath]: packageJsonConfig,
- [eslintRcPath]: "",
- [eslintIgnorePath]: eslintIgnoreContent,
- [prettierRcPath]: prettierRcContent,
- [prettierIgnorePath]: "",
- });
- const biomeJsonPath = api.fileAPI.joinPaths(
- api.fileAPI.currentWorkingDirectory,
- "biome.json",
- );
-
- const externalFileCommands = await transform(api);
-
- const packageJsonCommand = externalFileCommands.find(
- (command) =>
- command.kind === "upsertFile" && command.path === packageJsonPath,
- );
-
- ok(packageJsonCommand);
- ok(packageJsonCommand.kind === "upsertFile");
- deepEqual(
- packageJsonCommand.newData.replace(/\W/gm, ""),
- `
- {
- "name": "package-name",
- "dependencies": {},
- "devDependencies": {
- "@biomejs/biome": "1.5.3"
- },
- "main": "./dist/index.cjs",
- "scripts": {
- "start": "pnpm run build:cjs && node ./dist/index.cjs",
- "lint:eslint": "pnpm dlx @biomejs/biome lint . --apply",
- "lint:prettier": "pnpm dlx @biomejs/biome format --write .",
- "NOTE": "You can apply both linter, formatter and import ordering by using https://biomejs.dev/reference/cli/#biome-check",
- "NOTE2": "There is an ongoing work to release prettier-tailwind-plugin alternative: https://biomejs.dev/linter/rules/use-sorted-classes/, https://github.com/biomejs/biome/issues/1274"
- },
- "files": [
- "prettier-test-no-replace",
- "README.md",
- ".codemodrc.json",
- "./dist/index.cjs"
- ],
- "lint-staged": {
- "*.js": "pnpm dlx @biomejs/biome lint --apply",
- "*.ts": "pnpm dlx @biomejs/biome lint --apply"
- },
- "type": "module"
- }
- `.replace(/\W/gm, ""),
- );
-
- ok(
- externalFileCommands.some(
- (command) =>
- command.kind === "upsertFile" &&
- command.path === biomeJsonPath &&
- command.newData.replace(/\W/gm, "") ===
- `
- {
- "linter": {
- "ignore": [
- "dist",
- "build",
- "pnpm-lock.yaml",
- "node_modules"
- "ignore-key",
- ],
- "rules": {
- "suspicious": {
- "noDoubleEquals": "warn",
- "noAssignInExpressions": "warn"
- },
- "correctness": {
- "noUnusedVariables": "off"
- }
- }
- },
- "formatter": {
- "indentStyle": "tab"
- "ignore": [],
- }
- }
- `.replace(/\W/gm, ""),
- ),
- );
- });
-});
diff --git a/packages/codemods/eslint/biome/migrate-rules/tsconfig.json b/packages/codemods/eslint/biome/migrate-rules/tsconfig.json
deleted file mode 100644
index 1683f3537..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/tsconfig.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "extends": "@codemod-com/tsconfig/codemod.json",
- "include": [
- "types/*.d.ts",
- "./src/**/*.ts",
- "./src/**/*.js",
- "./test/**/*.ts",
- "./test/**/*.js"
- ]
-}
diff --git a/packages/codemods/eslint/biome/migrate-rules/types/biome.d.ts b/packages/codemods/eslint/biome/migrate-rules/types/biome.d.ts
deleted file mode 100644
index af697a9c4..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/types/biome.d.ts
+++ /dev/null
@@ -1,1499 +0,0 @@
-/**MIT License
- *
- * Copyright (c) 2023 Biome Developers and Contributors.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
-*/
-/* eslint-disable */
-/**
- * This file was automatically generated by json-schema-to-typescript.
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
- * and run json-schema-to-typescript to regenerate this file.
- */
-
-export type PlainIndentStyle = "tab" | "space";
-export type LineEnding = "lf" | "crlf" | "cr";
-/**
- * Validated value for the `line_width` formatter options
- *
- * The allowed range of values is 1..=320
- */
-export type LineWidth = number;
-export type QuoteStyle = "double" | "single";
-export type StringSet = string[];
-export type ArrowParentheses = "always" | "asNeeded";
-export type QuoteProperties = "asNeeded" | "preserve";
-export type Semicolons = "always" | "asNeeded";
-/**
- * Print trailing commas wherever possible in multi-line comma-separated syntactic structures.
- */
-export type TrailingComma = "all" | "es5" | "none";
-export type RuleConfiguration = RulePlainConfiguration | RuleWithOptions;
-export type RulePlainConfiguration = "warn" | "error" | "off";
-export type PossibleOptions =
- | ComplexityOptions
- | ConsistentArrayTypeOptions
- | FilenamingConventionOptions
- | HooksOptions
- | DeprecatedHooksOptions
- | NamingConventionOptions
- | RestrictedGlobalsOptions
- | ValidAriaRoleOptions;
-export type ConsistentArrayType = "shorthand" | "generic";
-/**
- * Supported cases for TypeScript `enum` member names.
- */
-export type FilenameCase = "camelCase" | "export" | "kebab-case" | "PascalCase" | "snake_case";
-export type FilenameCases = FilenameCase[];
-/**
- * Supported cases for TypeScript `enum` member names.
- */
-export type EnumMemberCase = "PascalCase" | "CONSTANT_CASE" | "camelCase";
-export type Overrides = OverridePattern[];
-export type VcsClientKind = "git";
-
-/**
- * The configuration that is contained inside the file `biome.json`
- */
-export interface Configuration {
- /**
- * A field for the [JSON schema](https://json-schema.org/) specification
- */
- $schema?: string | null;
- /**
- * Specific configuration for the Css language
- */
- css?: CssConfiguration | null;
- /**
- * A list of paths to other JSON files, used to extends the current configuration.
- */
- extends?: StringSet | null;
- /**
- * The configuration of the filesystem
- */
- files?: FilesConfiguration | null;
- /**
- * The configuration of the formatter
- */
- formatter?: FormatterConfiguration | null;
- /**
- * Specific configuration for the JavaScript language
- */
- javascript?: JavascriptConfiguration | null;
- /**
- * Specific configuration for the Json language
- */
- json?: JsonConfiguration | null;
- /**
- * The configuration for the linter
- */
- linter?: LinterConfiguration | null;
- /**
- * The configuration of the import sorting
- */
- organizeImports?: OrganizeImports | null;
- /**
- * A list of granular patterns that should be applied only to a sub set of files
- */
- overrides?: Overrides | null;
- /**
- * The configuration of the VCS integration
- */
- vcs?: VcsConfiguration | null;
-}
-/**
- * Options applied to CSS files
- */
-export interface CssConfiguration {
- /**
- * Formatting options
- */
- formatter?: CssFormatter | null;
- /**
- * Parsing options
- */
- parser?: CssParser | null;
-}
-export interface CssFormatter {
- /**
- * Control the formatter for CSS (and its super languages) files.
- */
- enabled?: boolean | null;
- /**
- * The size of the indentation applied to CSS (and its super languages) files. Default to 2.
- */
- indentSize?: number | null;
- /**
- * The indent style applied to CSS (and its super languages) files.
- */
- indentStyle?: PlainIndentStyle | null;
- /**
- * The size of the indentation applied to CSS (and its super languages) files. Default to 2.
- */
- indentWidth?: number | null;
- /**
- * The type of line ending applied to CSS (and its super languages) files.
- */
- lineEnding?: LineEnding | null;
- /**
- * What's the max width of a line applied to CSS (and its super languages) files. Defaults to 80.
- */
- lineWidth?: LineWidth | null;
- quoteStyle?: QuoteStyle | null;
-}
-/**
- * Options that changes how the CSS parser behaves
- */
-export interface CssParser {
- /**
- * Allow comments to appear on incorrect lines in `.css` files
- */
- allowWrongLineComments?: boolean | null;
-}
-/**
- * The configuration of the filesystem
- */
-export interface FilesConfiguration {
- /**
- * A list of Unix shell style patterns. Biome will ignore files/folders that will match these patterns.
- */
- ignore?: StringSet | null;
- /**
- * Tells Biome to not emit diagnostics when handling files that doesn't know
- */
- ignoreUnknown?: boolean | null;
- /**
- * A list of Unix shell style patterns. Biome will handle only those files/folders that will match these patterns.
- */
- include?: StringSet | null;
- /**
- * The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reasons. Defaults to 1 MiB
- */
- maxSize?: number | null;
-}
-/**
- * Generic options applied to all files
- */
-export interface FormatterConfiguration {
- enabled?: boolean | null;
- /**
- * Stores whether formatting should be allowed to proceed if a given file has syntax errors
- */
- formatWithErrors?: boolean | null;
- /**
- * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.
- */
- ignore?: StringSet | null;
- /**
- * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.
- */
- include?: StringSet | null;
- /**
- * The size of the indentation, 2 by default (deprecated, use `indent-width`)
- */
- indentSize?: number | null;
- /**
- * The indent style.
- */
- indentStyle?: PlainIndentStyle | null;
- /**
- * The size of the indentation, 2 by default
- */
- indentWidth?: number | null;
- /**
- * The type of line ending.
- */
- lineEnding?: LineEnding | null;
- /**
- * What's the max width of a line. Defaults to 80.
- */
- lineWidth?: LineWidth | null;
-}
-/**
- * A set of options applied to the JavaScript files
- */
-export interface JavascriptConfiguration {
- /**
- * Formatting options
- */
- formatter?: JavascriptFormatter | null;
- /**
- * A list of global bindings that should be ignored by the analyzers
- *
- * If defined here, they should not emit diagnostics.
- */
- globals?: StringSet | null;
- organize_imports?: JavascriptOrganizeImports | null;
- /**
- * Parsing options
- */
- parser?: JavascriptParser | null;
-}
-/**
- * Formatting options specific to the JavaScript files
- */
-export interface JavascriptFormatter {
- /**
- * Whether to add non-necessary parentheses to arrow functions. Defaults to "always".
- */
- arrowParentheses?: ArrowParentheses | null;
- /**
- * Whether to hug the closing bracket of multiline HTML/JSX tags to the end of the last line, rather than being alone on the following line. Defaults to false.
- */
- bracketSameLine?: boolean | null;
- /**
- * Whether to insert spaces around brackets in object literals. Defaults to true.
- */
- bracketSpacing?: boolean | null;
- /**
- * Control the formatter for JavaScript (and its super languages) files.
- */
- enabled?: boolean | null;
- /**
- * The size of the indentation applied to JavaScript (and its super languages) files. Default to 2.
- */
- indentSize?: number | null;
- /**
- * The indent style applied to JavaScript (and its super languages) files.
- */
- indentStyle?: PlainIndentStyle | null;
- /**
- * The size of the indentation applied to JavaScript (and its super languages) files. Default to 2.
- */
- indentWidth?: number | null;
- /**
- * The type of quotes used in JSX. Defaults to double.
- */
- jsxQuoteStyle?: QuoteStyle | null;
- /**
- * The type of line ending applied to JavaScript (and its super languages) files.
- */
- lineEnding?: LineEnding | null;
- /**
- * What's the max width of a line applied to JavaScript (and its super languages) files. Defaults to 80.
- */
- lineWidth?: LineWidth | null;
- /**
- * When properties in objects are quoted. Defaults to asNeeded.
- */
- quoteProperties?: QuoteProperties | null;
- /**
- * The type of quotes used in JavaScript code. Defaults to double.
- */
- quoteStyle?: QuoteStyle | null;
- /**
- * Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI.
- */
- semicolons?: Semicolons | null;
- /**
- * Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all".
- */
- trailingComma?: TrailingComma | null;
-}
-export interface JavascriptOrganizeImports {}
-/**
- * Options that changes how the JavaScript parser behaves
- */
-export interface JavascriptParser {
- /**
- * It enables the experimental and unsafe parsing of parameter decorators
- *
- * These decorators belong to an old proposal, and they are subject to change.
- */
- unsafeParameterDecoratorsEnabled?: boolean | null;
-}
-/**
- * Options applied to JSON files
- */
-export interface JsonConfiguration {
- /**
- * Formatting options
- */
- formatter?: JsonFormatter | null;
- /**
- * Parsing options
- */
- parser?: JsonParser | null;
-}
-export interface JsonFormatter {
- /**
- * Control the formatter for JSON (and its super languages) files.
- */
- enabled?: boolean | null;
- /**
- * The size of the indentation applied to JSON (and its super languages) files. Default to 2.
- */
- indentSize?: number | null;
- /**
- * The indent style applied to JSON (and its super languages) files.
- */
- indentStyle?: PlainIndentStyle | null;
- /**
- * The size of the indentation applied to JSON (and its super languages) files. Default to 2.
- */
- indentWidth?: number | null;
- /**
- * The type of line ending applied to JSON (and its super languages) files.
- */
- lineEnding?: LineEnding | null;
- /**
- * What's the max width of a line applied to JSON (and its super languages) files. Defaults to 80.
- */
- lineWidth?: LineWidth | null;
-}
-/**
- * Options that changes how the JSON parser behaves
- */
-export interface JsonParser {
- /**
- * Allow parsing comments in `.json` files
- */
- allowComments?: boolean | null;
- /**
- * Allow parsing trailing commas in `.json` files
- */
- allowTrailingCommas?: boolean | null;
-}
-export interface LinterConfiguration {
- /**
- * if `false`, it disables the feature and the linter won't be executed. `true` by default
- */
- enabled?: boolean | null;
- /**
- * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.
- */
- ignore?: StringSet | null;
- /**
- * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.
- */
- include?: StringSet | null;
- /**
- * List of rules
- */
- rules?: Rules | null;
-}
-export interface Rules {
- a11y?: A11Y | null;
- /**
- * It enables ALL rules. The rules that belong to `nursery` won't be enabled.
- */
- all?: boolean | null;
- complexity?: Complexity | null;
- correctness?: Correctness | null;
- nursery?: Nursery | null;
- performance?: Performance | null;
- /**
- * It enables the lint rules recommended by Biome. `true` by default.
- */
- recommended?: boolean | null;
- security?: Security | null;
- style?: Style | null;
- suspicious?: Suspicious | null;
-}
-/**
- * A list of rules that belong to this group
- */
-export interface A11Y {
- /**
- * It enables ALL rules for this group.
- */
- all?: boolean | null;
- /**
- * Enforce that the accessKey attribute is not used on any HTML element.
- */
- noAccessKey?: RuleConfiguration | null;
- /**
- * Enforce that aria-hidden="true" is not set on focusable elements.
- */
- noAriaHiddenOnFocusable?: RuleConfiguration | null;
- /**
- * Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes.
- */
- noAriaUnsupportedElements?: RuleConfiguration | null;
- /**
- * Enforce that autoFocus prop is not used on elements.
- */
- noAutofocus?: RuleConfiguration | null;
- /**
- * Disallow target="_blank" attribute without rel="noreferrer"
- */
- noBlankTarget?: RuleConfiguration | null;
- /**
- * Enforces that no distracting elements are used.
- */
- noDistractingElements?: RuleConfiguration | null;
- /**
- * The scope prop should be used only on elements.
- */
- noHeaderScope?: RuleConfiguration | null;
- /**
- * Enforce that non-interactive ARIA roles are not assigned to interactive HTML elements.
- */
- noInteractiveElementToNoninteractiveRole?: RuleConfiguration | null;
- /**
- * Enforce that interactive ARIA roles are not assigned to non-interactive HTML elements.
- */
- noNoninteractiveElementToInteractiveRole?: RuleConfiguration | null;
- /**
- * Enforce that tabIndex is not assigned to non-interactive HTML elements.
- */
- noNoninteractiveTabindex?: RuleConfiguration | null;
- /**
- * Prevent the usage of positive integers on tabIndex property
- */
- noPositiveTabindex?: RuleConfiguration | null;
- /**
- * Enforce img alt prop does not contain the word "image", "picture", or "photo".
- */
- noRedundantAlt?: RuleConfiguration | null;
- /**
- * Enforce explicit role property is not the same as implicit/default role property on an element.
- */
- noRedundantRoles?: RuleConfiguration | null;
- /**
- * Enforces the usage of the title element for the svg element.
- */
- noSvgWithoutTitle?: RuleConfiguration | null;
- /**
- * It enables the recommended rules for this group
- */
- recommended?: boolean | null;
- /**
- * Enforce that all elements that require alternative text have meaningful information to relay back to the end user.
- */
- useAltText?: RuleConfiguration | null;
- /**
- * Enforce that anchors have content and that the content is accessible to screen readers.
- */
- useAnchorContent?: RuleConfiguration | null;
- /**
- * Enforce that tabIndex is assigned to non-interactive HTML elements with aria-activedescendant.
- */
- useAriaActivedescendantWithTabindex?: RuleConfiguration | null;
- /**
- * Enforce that elements with ARIA roles must have all required ARIA attributes for that role.
- */
- useAriaPropsForRole?: RuleConfiguration | null;
- /**
- * Enforces the usage of the attribute type for the element button
- */
- useButtonType?: RuleConfiguration | null;
- /**
- * Enforce that heading elements (h1, h2, etc.) have content and that the content is accessible to screen readers. Accessible means that it is not hidden using the aria-hidden prop.
- */
- useHeadingContent?: RuleConfiguration | null;
- /**
- * Enforce that html element has lang attribute.
- */
- useHtmlLang?: RuleConfiguration | null;
- /**
- * Enforces the usage of the attribute title for the element iframe.
- */
- useIframeTitle?: RuleConfiguration | null;
- /**
- * Enforce onClick is accompanied by at least one of the following: onKeyUp, onKeyDown, onKeyPress.
- */
- useKeyWithClickEvents?: RuleConfiguration | null;
- /**
- * Enforce onMouseOver / onMouseOut are accompanied by onFocus / onBlur.
- */
- useKeyWithMouseEvents?: RuleConfiguration | null;
- /**
- * Enforces that audio and video elements must have a track for captions.
- */
- useMediaCaption?: RuleConfiguration | null;
- /**
- * Enforce that all anchors are valid, and they are navigable elements.
- */
- useValidAnchor?: RuleConfiguration | null;
- /**
- * Ensures that ARIA properties aria-* are all valid.
- */
- useValidAriaProps?: RuleConfiguration | null;
- /**
- * Elements with ARIA roles must use a valid, non-abstract ARIA role.
- */
- useValidAriaRole?: RuleConfiguration | null;
- /**
- * Enforce that ARIA state and property values are valid.
- */
- useValidAriaValues?: RuleConfiguration | null;
- /**
- * Ensure that the attribute passed to the lang attribute is a correct ISO language and/or country.
- */
- useValidLang?: RuleConfiguration | null;
- [k: string]: unknown;
-}
-export interface RuleWithOptions {
- level: RulePlainConfiguration;
- options?: PossibleOptions | null;
-}
-/**
- * Options for the rule `noExcessiveCognitiveComplexity`.
- */
-export interface ComplexityOptions {
- /**
- * The maximum complexity score that we allow. Anything higher is considered excessive.
- */
- maxAllowedComplexity: number;
-}
-export interface ConsistentArrayTypeOptions {
- syntax: ConsistentArrayType;
-}
-/**
- * Rule's options.
- */
-export interface FilenamingConventionOptions {
- /**
- * Allowed cases for _TypeScript_ `enum` member names.
- */
- filenameCases?: FilenameCases;
- /**
- * If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. This does not affect other [Case].
- */
- strictCase?: boolean;
-}
-/**
- * Options for the rule `useExhaustiveDependencies`
- */
-export interface HooksOptions {
- /**
- * List of safe hooks
- */
- hooks: Hooks[];
-}
-export interface Hooks {
- /**
- * The "position" of the closure function, starting from zero.
- *
- * ### Example
- */
- closureIndex?: number | null;
- /**
- * The "position" of the array of dependencies, starting from zero.
- */
- dependenciesIndex?: number | null;
- /**
- * The name of the hook
- */
- name: string;
-}
-/**
- * Options for the `useHookAtTopLevel` rule have been deprecated, since we now use the React hook naming convention to determine whether a function is a hook.
- */
-export interface DeprecatedHooksOptions {}
-/**
- * Rule's options.
- */
-export interface NamingConventionOptions {
- /**
- * Allowed cases for _TypeScript_ `enum` member names.
- */
- enumMemberCase?: EnumMemberCase;
- /**
- * If `false`, then consecutive uppercase are allowed in _camel_ and _pascal_ cases. This does not affect other [Case].
- */
- strictCase?: boolean;
-}
-/**
- * Options for the rule `noRestrictedGlobals`.
- */
-export interface RestrictedGlobalsOptions {
- /**
- * A list of names that should trigger the rule
- */
- deniedGlobals: string[];
-}
-export interface ValidAriaRoleOptions {
- allowInvalidRoles: string[];
- ignoreNonDom: boolean;
-}
-/**
- * A list of rules that belong to this group
- */
-export interface Complexity {
- /**
- * It enables ALL rules for this group.
- */
- all?: boolean | null;
- /**
- * Disallow primitive type aliases and misleading types.
- */
- noBannedTypes?: RuleConfiguration | null;
- /**
- * Disallow functions that exceed a given Cognitive Complexity score.
- */
- noExcessiveCognitiveComplexity?: RuleConfiguration | null;
- /**
- * Disallow unnecessary boolean casts
- */
- noExtraBooleanCast?: RuleConfiguration | null;
- /**
- * Prefer for...of statement instead of Array.forEach.
- */
- noForEach?: RuleConfiguration | null;
- /**
- * Disallow unclear usage of consecutive space characters in regular expression literals
- */
- noMultipleSpacesInRegularExpressionLiterals?: RuleConfiguration | null;
- /**
- * This rule reports when a class has no non-static members, such as for a class used exclusively as a static namespace.
- */
- noStaticOnlyClass?: RuleConfiguration | null;
- /**
- * Disallow this and super in static contexts.
- */
- noThisInStatic?: RuleConfiguration | null;
- /**
- * Disallow unnecessary catch clauses.
- */
- noUselessCatch?: RuleConfiguration | null;
- /**
- * Disallow unnecessary constructors.
- */
- noUselessConstructor?: RuleConfiguration | null;
- /**
- * Disallow empty exports that don't change anything in a module file.
- */
- noUselessEmptyExport?: RuleConfiguration | null;
- /**
- * Disallow unnecessary fragments
- */
- noUselessFragments?: RuleConfiguration | null;
- /**
- * Disallow unnecessary labels.
- */
- noUselessLabel?: RuleConfiguration | null;
- /**
- * Disallow renaming import, export, and destructured assignments to the same name.
- */
- noUselessRename?: RuleConfiguration | null;
- /**
- * Disallow useless case in switch statements.
- */
- noUselessSwitchCase?: RuleConfiguration | null;
- /**
- * Disallow useless this aliasing.
- */
- noUselessThisAlias?: RuleConfiguration | null;
- /**
- * Disallow using any or unknown as type constraint.
- */
- noUselessTypeConstraint?: RuleConfiguration | null;
- /**
- * Disallow the use of void operators, which is not a familiar operator.
- */
- noVoid?: RuleConfiguration | null;
- /**
- * Disallow with statements in non-strict contexts.
- */
- noWith?: RuleConfiguration | null;
- /**
- * It enables the recommended rules for this group
- */
- recommended?: boolean | null;
- /**
- * Use arrow functions over function expressions.
- */
- useArrowFunction?: RuleConfiguration | null;
- /**
- * Promotes the use of .flatMap() when map().flat() are used together.
- */
- useFlatMap?: RuleConfiguration | null;
- /**
- * Enforce the usage of a literal access to properties over computed property access.
- */
- useLiteralKeys?: RuleConfiguration | null;
- /**
- * Enforce using concise optional chain instead of chained logical expressions.
- */
- useOptionalChain?: RuleConfiguration | null;
- /**
- * Enforce the use of the regular expression literals instead of the RegExp constructor if possible.
- */
- useRegexLiterals?: RuleConfiguration | null;
- /**
- * Disallow number literal object member names which are not base10 or uses underscore as separator
- */
- useSimpleNumberKeys?: RuleConfiguration | null;
- /**
- * Discard redundant terms from logical expressions.
- */
- useSimplifiedLogicExpression?: RuleConfiguration | null;
- [k: string]: unknown;
-}
-/**
- * A list of rules that belong to this group
- */
-export interface Correctness {
- /**
- * It enables ALL rules for this group.
- */
- all?: boolean | null;
- /**
- * Prevent passing of children as props.
- */
- noChildrenProp?: RuleConfiguration | null;
- /**
- * Prevents from having const variables being re-assigned.
- */
- noConstAssign?: RuleConfiguration | null;
- /**
- * Disallow constant expressions in conditions
- */
- noConstantCondition?: RuleConfiguration | null;
- /**
- * Disallow returning a value from a constructor.
- */
- noConstructorReturn?: RuleConfiguration | null;
- /**
- * Disallow empty character classes in regular expression literals.
- */
- noEmptyCharacterClassInRegex?: RuleConfiguration | null;
- /**
- * Disallows empty destructuring patterns.
- */
- noEmptyPattern?: RuleConfiguration | null;
- /**
- * Disallow calling global object properties as functions
- */
- noGlobalObjectCalls?: RuleConfiguration | null;
- /**
- * Disallow function and var declarations that are accessible outside their block.
- */
- noInnerDeclarations?: RuleConfiguration | null;
- /**
- * Prevents the incorrect use of super() inside classes. It also checks whether a call super() is missing from classes that extends other constructors.
- */
- noInvalidConstructorSuper?: RuleConfiguration | null;
- /**
- * Disallow new operators with global non-constructor functions.
- */
- noInvalidNewBuiltin?: RuleConfiguration | null;
- /**
- * Disallow new operators with the Symbol object.
- */
- noNewSymbol?: RuleConfiguration | null;
- /**
- * Disallow \8 and \9 escape sequences in string literals.
- */
- noNonoctalDecimalEscape?: RuleConfiguration | null;
- /**
- * Disallow literal numbers that lose precision
- */
- noPrecisionLoss?: RuleConfiguration | null;
- /**
- * Prevent the usage of the return value of React.render.
- */
- noRenderReturnValue?: RuleConfiguration | null;
- /**
- * Disallow assignments where both sides are exactly the same.
- */
- noSelfAssign?: RuleConfiguration | null;
- /**
- * Disallow returning a value from a setter
- */
- noSetterReturn?: RuleConfiguration | null;
- /**
- * Disallow comparison of expressions modifying the string case with non-compliant value.
- */
- noStringCaseMismatch?: RuleConfiguration | null;
- /**
- * Disallow lexical declarations in switch clauses.
- */
- noSwitchDeclarations?: RuleConfiguration | null;
- /**
- * Prevents the usage of variables that haven't been declared inside the document.
- */
- noUndeclaredVariables?: RuleConfiguration | null;
- /**
- * Avoid using unnecessary continue.
- */
- noUnnecessaryContinue?: RuleConfiguration | null;
- /**
- * Disallow unreachable code
- */
- noUnreachable?: RuleConfiguration | null;
- /**
- * Ensures the super() constructor is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass
- */
- noUnreachableSuper?: RuleConfiguration | null;
- /**
- * Disallow control flow statements in finally blocks.
- */
- noUnsafeFinally?: RuleConfiguration | null;
- /**
- * Disallow the use of optional chaining in contexts where the undefined value is not allowed.
- */
- noUnsafeOptionalChaining?: RuleConfiguration | null;
- /**
- * Disallow unused labels.
- */
- noUnusedLabels?: RuleConfiguration | null;
- /**
- * Disallow unused variables.
- */
- noUnusedVariables?: RuleConfiguration | null;
- /**
- * This rules prevents void elements (AKA self-closing elements) from having children.
- */
- noVoidElementsWithChildren?: RuleConfiguration | null;
- /**
- * Disallow returning a value from a function with the return type 'void'
- */
- noVoidTypeReturn?: RuleConfiguration | null;
- /**
- * It enables the recommended rules for this group
- */
- recommended?: boolean | null;
- /**
- * Enforce all dependencies are correctly specified in a React hook.
- */
- useExhaustiveDependencies?: RuleConfiguration | null;
- /**
- * Enforce that all React hooks are being called from the Top Level component functions.
- */
- useHookAtTopLevel?: RuleConfiguration | null;
- /**
- * Require calls to isNaN() when checking for NaN.
- */
- useIsNan?: RuleConfiguration | null;
- /**
- * Enforce "for" loop update clause moving the counter in the right direction.
- */
- useValidForDirection?: RuleConfiguration | null;
- /**
- * Require generator functions to contain yield.
- */
- useYield?: RuleConfiguration | null;
- [k: string]: unknown;
-}
-/**
- * A list of rules that belong to this group
- */
-export interface Nursery {
- /**
- * It enables ALL rules for this group.
- */
- all?: boolean | null;
- /**
- * Disallow two keys with the same name inside a JSON object.
- */
- noDuplicateJsonKeys?: RuleConfiguration | null;
- /**
- * Disallow empty block statements and static blocks.
- */
- noEmptyBlockStatements?: RuleConfiguration | null;
- /**
- * Disallow empty type parameters in type aliases and interfaces.
- */
- noEmptyTypeParameters?: RuleConfiguration | null;
- /**
- * Disallow assignments to native objects and read-only global variables.
- */
- noGlobalAssign?: RuleConfiguration | null;
- /**
- * Disallow the use of global eval().
- */
- noGlobalEval?: RuleConfiguration | null;
- /**
- * Disallow the use of variables and function parameters before their declaration
- */
- noInvalidUseBeforeDeclaration?: RuleConfiguration | null;
- /**
- * Disallow characters made with multiple code points in character class syntax.
- */
- noMisleadingCharacterClass?: RuleConfiguration | null;
- /**
- * Forbid the use of Node.js builtin modules.
- */
- noNodejsModules?: RuleConfiguration | null;
- /**
- * Disallow then property.
- */
- noThenProperty?: RuleConfiguration | null;
- /**
- * Disallow unused imports.
- */
- noUnusedImports?: RuleConfiguration | null;
- /**
- * Disallow unused private class members
- */
- noUnusedPrivateClassMembers?: RuleConfiguration | null;
- /**
- * Disallow unnecessary nested block statements.
- */
- noUselessLoneBlockStatements?: RuleConfiguration | null;
- /**
- * Disallow ternary operators when simpler alternatives exist.
- */
- noUselessTernary?: RuleConfiguration | null;
- /**
- * It enables the recommended rules for this group
- */
- recommended?: boolean | null;
- /**
- * Ensure async functions utilize await.
- */
- useAwait?: RuleConfiguration | null;
- /**
- * Require consistently using either T[] or Array
- */
- useConsistentArrayType?: RuleConfiguration | null;
- /**
- * Promotes the use of export type for types.
- */
- useExportType?: RuleConfiguration | null;
- /**
- * Enforce naming conventions for JavaScript and TypeScript filenames.
- */
- useFilenamingConvention?: RuleConfiguration | null;
- /**
- * This rule recommends a for-of loop when in a for loop, the index used to extract an item from the iterated array.
- */
- useForOf?: RuleConfiguration | null;
- /**
- * Enforce the use of import type when an import only has specifiers with type qualifier.
- */
- useGroupedTypeImport?: RuleConfiguration | null;
- /**
- * Disallows package private imports.
- */
- useImportRestrictions?: RuleConfiguration | null;
- /**
- * Promotes the use of import type for types.
- */
- useImportType?: RuleConfiguration | null;
- /**
- * Enforces using the node: protocol for Node.js builtin modules.
- */
- useNodejsImportProtocol?: RuleConfiguration | null;
- /**
- * Use the Number properties instead of global ones.
- */
- useNumberNamespace?: RuleConfiguration | null;
- /**
- * Enforce using function types instead of object type with call signatures.
- */
- useShorthandFunctionType?: RuleConfiguration | null;
- [k: string]: unknown;
-}
-/**
- * A list of rules that belong to this group
- */
-export interface Performance {
- /**
- * It enables ALL rules for this group.
- */
- all?: boolean | null;
- /**
- * Disallow the use of spread (...) syntax on accumulators.
- */
- noAccumulatingSpread?: RuleConfiguration | null;
- /**
- * Disallow the use of the delete operator.
- */
- noDelete?: RuleConfiguration | null;
- /**
- * It enables the recommended rules for this group
- */
- recommended?: boolean | null;
- [k: string]: unknown;
-}
-/**
- * A list of rules that belong to this group
- */
-export interface Security {
- /**
- * It enables ALL rules for this group.
- */
- all?: boolean | null;
- /**
- * Prevent the usage of dangerous JSX props
- */
- noDangerouslySetInnerHtml?: RuleConfiguration | null;
- /**
- * Report when a DOM element or a component uses both children and dangerouslySetInnerHTML prop.
- */
- noDangerouslySetInnerHtmlWithChildren?: RuleConfiguration | null;
- /**
- * It enables the recommended rules for this group
- */
- recommended?: boolean | null;
- [k: string]: unknown;
-}
-/**
- * A list of rules that belong to this group
- */
-export interface Style {
- /**
- * It enables ALL rules for this group.
- */
- all?: boolean | null;
- /**
- * Disallow the use of arguments.
- */
- noArguments?: RuleConfiguration | null;
- /**
- * Disallow comma operator.
- */
- noCommaOperator?: RuleConfiguration | null;
- /**
- * Disallow default exports.
- */
- noDefaultExport?: RuleConfiguration | null;
- /**
- * Disallow implicit true values on JSX boolean attributes
- */
- noImplicitBoolean?: RuleConfiguration | null;
- /**
- * Disallow type annotations for variables, parameters, and class properties initialized with a literal expression.
- */
- noInferrableTypes?: RuleConfiguration | null;
- /**
- * Disallow the use of TypeScript's namespaces.
- */
- noNamespace?: RuleConfiguration | null;
- /**
- * Disallow negation in the condition of an if statement if it has an else clause.
- */
- noNegationElse?: RuleConfiguration | null;
- /**
- * Disallow non-null assertions using the ! postfix operator.
- */
- noNonNullAssertion?: RuleConfiguration | null;
- /**
- * Disallow reassigning function parameters.
- */
- noParameterAssign?: RuleConfiguration | null;
- /**
- * Disallow the use of parameter properties in class constructors.
- */
- noParameterProperties?: RuleConfiguration | null;
- /**
- * This rule allows you to specify global variable names that you don’t want to use in your application.
- */
- noRestrictedGlobals?: RuleConfiguration | null;
- /**
- * Disallow the use of constants which its value is the upper-case version of its name.
- */
- noShoutyConstants?: RuleConfiguration | null;
- /**
- * Disallow template literals if interpolation and special-character handling are not needed
- */
- noUnusedTemplateLiteral?: RuleConfiguration | null;
- /**
- * Disallow else block when the if block breaks early.
- */
- noUselessElse?: RuleConfiguration | null;
- /**
- * Disallow the use of var
- */
- noVar?: RuleConfiguration | null;
- /**
- * It enables the recommended rules for this group
- */
- recommended?: boolean | null;
- /**
- * Enforce the use of as const over literal type and type annotation.
- */
- useAsConstAssertion?: RuleConfiguration | null;
- /**
- * Requires following curly brace conventions.
- */
- useBlockStatements?: RuleConfiguration | null;
- /**
- * Enforce using else if instead of nested if in else clauses.
- */
- useCollapsedElseIf?: RuleConfiguration | null;
- /**
- * Require const declarations for variables that are never reassigned after declared.
- */
- useConst?: RuleConfiguration | null;
- /**
- * Enforce default function parameters and optional function parameters to be last.
- */
- useDefaultParameterLast?: RuleConfiguration | null;
- /**
- * Require that each enum member value be explicitly initialized.
- */
- useEnumInitializers?: RuleConfiguration | null;
- /**
- * Disallow the use of Math.pow in favor of the ** operator.
- */
- useExponentiationOperator?: RuleConfiguration | null;
- /**
- * This rule enforces the use of <>...> over ....
- */
- useFragmentSyntax?: RuleConfiguration | null;
- /**
- * Require all enum members to be literal values.
- */
- useLiteralEnumMembers?: RuleConfiguration | null;
- /**
- * Enforce naming conventions for everything across a codebase.
- */
- useNamingConvention?: RuleConfiguration | null;
- /**
- * Disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals
- */
- useNumericLiterals?: RuleConfiguration | null;
- /**
- * Prevent extra closing tags for components without children
- */
- useSelfClosingElements?: RuleConfiguration | null;
- /**
- * When expressing array types, this rule promotes the usage of T[] shorthand instead of Array.
- */
- useShorthandArrayType?: RuleConfiguration | null;
- /**
- * Require assignment operator shorthand where possible.
- */
- useShorthandAssign?: RuleConfiguration | null;
- /**
- * Enforces switch clauses have a single statement, emits a quick fix wrapping the statements in a block.
- */
- useSingleCaseStatement?: RuleConfiguration | null;
- /**
- * Disallow multiple variable declarations in the same variable statement
- */
- useSingleVarDeclarator?: RuleConfiguration | null;
- /**
- * Prefer template literals over string concatenation.
- */
- useTemplate?: RuleConfiguration | null;
- /**
- * Enforce the use of while loops instead of for loops when the initializer and update expressions are not needed.
- */
- useWhile?: RuleConfiguration | null;
- [k: string]: unknown;
-}
-/**
- * A list of rules that belong to this group
- */
-export interface Suspicious {
- /**
- * It enables ALL rules for this group.
- */
- all?: boolean | null;
- /**
- * Usually, the definition in the standard library is more precise than what people come up with or the used constant exceeds the maximum precision of the number type.
- */
- noApproximativeNumericConstant?: RuleConfiguration | null;
- /**
- * Discourage the usage of Array index in keys.
- */
- noArrayIndexKey?: RuleConfiguration | null;
- /**
- * Disallow assignments in expressions.
- */
- noAssignInExpressions?: RuleConfiguration | null;
- /**
- * Disallows using an async function as a Promise executor.
- */
- noAsyncPromiseExecutor?: RuleConfiguration | null;
- /**
- * Disallow reassigning exceptions in catch clauses.
- */
- noCatchAssign?: RuleConfiguration | null;
- /**
- * Disallow reassigning class members.
- */
- noClassAssign?: RuleConfiguration | null;
- /**
- * Prevent comments from being inserted as text nodes
- */
- noCommentText?: RuleConfiguration | null;
- /**
- * Disallow comparing against -0
- */
- noCompareNegZero?: RuleConfiguration | null;
- /**
- * Disallow labeled statements that are not loops.
- */
- noConfusingLabels?: RuleConfiguration | null;
- /**
- * Disallow void type outside of generic or return types.
- */
- noConfusingVoidType?: RuleConfiguration | null;
- /**
- * Disallow the use of console.log
- */
- noConsoleLog?: RuleConfiguration | null;
- /**
- * Disallow TypeScript const enum
- */
- noConstEnum?: RuleConfiguration | null;
- /**
- * Prevents from having control characters and some escape sequences that match control characters in regular expressions.
- */
- noControlCharactersInRegex?: RuleConfiguration | null;
- /**
- * Disallow the use of debugger
- */
- noDebugger?: RuleConfiguration | null;
- /**
- * Require the use of === and !==
- */
- noDoubleEquals?: RuleConfiguration | null;
- /**
- * Disallow duplicate case labels.
- */
- noDuplicateCase?: RuleConfiguration | null;
- /**
- * Disallow duplicate class members.
- */
- noDuplicateClassMembers?: RuleConfiguration | null;
- /**
- * Prevents JSX properties to be assigned multiple times.
- */
- noDuplicateJsxProps?: RuleConfiguration | null;
- /**
- * Prevents object literals having more than one property declaration for the same name.
- */
- noDuplicateObjectKeys?: RuleConfiguration | null;
- /**
- * Disallow duplicate function parameter name.
- */
- noDuplicateParameters?: RuleConfiguration | null;
- /**
- * Disallow the declaration of empty interfaces.
- */
- noEmptyInterface?: RuleConfiguration | null;
- /**
- * Disallow the any type usage.
- */
- noExplicitAny?: RuleConfiguration | null;
- /**
- * Prevents the wrong usage of the non-null assertion operator (!) in TypeScript files.
- */
- noExtraNonNullAssertion?: RuleConfiguration | null;
- /**
- * Disallow fallthrough of switch clauses.
- */
- noFallthroughSwitchClause?: RuleConfiguration | null;
- /**
- * Disallow reassigning function declarations.
- */
- noFunctionAssign?: RuleConfiguration | null;
- /**
- * Use Number.isFinite instead of global isFinite.
- */
- noGlobalIsFinite?: RuleConfiguration | null;
- /**
- * Use Number.isNaN instead of global isNaN.
- */
- noGlobalIsNan?: RuleConfiguration | null;
- /**
- * Disallow use of implicit any type on variable declarations.
- */
- noImplicitAnyLet?: RuleConfiguration | null;
- /**
- * Disallow assigning to imported bindings
- */
- noImportAssign?: RuleConfiguration | null;
- /**
- * Disallow labels that share a name with a variable
- */
- noLabelVar?: RuleConfiguration | null;
- /**
- * Enforce proper usage of new and constructor.
- */
- noMisleadingInstantiator?: RuleConfiguration | null;
- /**
- * Disallow shorthand assign when variable appears on both sides.
- */
- noMisrefactoredShorthandAssign?: RuleConfiguration | null;
- /**
- * Disallow direct use of Object.prototype builtins.
- */
- noPrototypeBuiltins?: RuleConfiguration | null;
- /**
- * Disallow variable, function, class, and type redeclarations in the same scope.
- */
- noRedeclare?: RuleConfiguration | null;
- /**
- * Prevents from having redundant "use strict".
- */
- noRedundantUseStrict?: RuleConfiguration | null;
- /**
- * Disallow comparisons where both sides are exactly the same.
- */
- noSelfCompare?: RuleConfiguration | null;
- /**
- * Disallow identifiers from shadowing restricted names.
- */
- noShadowRestrictedNames?: RuleConfiguration | null;
- /**
- * Disallow sparse arrays
- */
- noSparseArray?: RuleConfiguration | null;
- /**
- * Disallow unsafe declaration merging between interfaces and classes.
- */
- noUnsafeDeclarationMerging?: RuleConfiguration | null;
- /**
- * Disallow using unsafe negation.
- */
- noUnsafeNegation?: RuleConfiguration | null;
- /**
- * It enables the recommended rules for this group
- */
- recommended?: boolean | null;
- /**
- * Enforce default clauses in switch statements to be last
- */
- useDefaultSwitchClauseLast?: RuleConfiguration | null;
- /**
- * Enforce get methods to always return a value.
- */
- useGetterReturn?: RuleConfiguration | null;
- /**
- * Use Array.isArray() instead of instanceof Array.
- */
- useIsArray?: RuleConfiguration | null;
- /**
- * Require using the namespace keyword over the module keyword to declare TypeScript namespaces.
- */
- useNamespaceKeyword?: RuleConfiguration | null;
- /**
- * This rule verifies the result of typeof $expr unary expressions is being compared to valid values, either string literals containing valid type names or other typeof expressions
- */
- useValidTypeof?: RuleConfiguration | null;
- [k: string]: unknown;
-}
-export interface OrganizeImports {
- /**
- * Enables the organization of imports
- */
- enabled?: boolean | null;
- /**
- * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.
- */
- ignore?: StringSet | null;
- /**
- * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.
- */
- include?: StringSet | null;
-}
-export interface OverridePattern {
- /**
- * Specific configuration for the Css language
- */
- css?: CssConfiguration | null;
- /**
- * Specific configuration for the Json language
- */
- formatter?: OverrideFormatterConfiguration | null;
- /**
- * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.
- */
- ignore?: StringSet | null;
- /**
- * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.
- */
- include?: StringSet | null;
- /**
- * Specific configuration for the JavaScript language
- */
- javascript?: JavascriptConfiguration | null;
- /**
- * Specific configuration for the Json language
- */
- json?: JsonConfiguration | null;
- /**
- * Specific configuration for the Json language
- */
- linter?: OverrideLinterConfiguration | null;
- /**
- * Specific configuration for the Json language
- */
- organizeImports?: OverrideOrganizeImportsConfiguration | null;
-}
-export interface OverrideFormatterConfiguration {
- enabled?: boolean | null;
- /**
- * Stores whether formatting should be allowed to proceed if a given file has syntax errors
- */
- formatWithErrors?: boolean | null;
- /**
- * The size of the indentation, 2 by default (deprecated, use `indent-width`)
- */
- indentSize?: number | null;
- /**
- * The indent style.
- */
- indentStyle?: PlainIndentStyle | null;
- /**
- * The size of the indentation, 2 by default
- */
- indentWidth?: number | null;
- /**
- * The type of line ending.
- */
- lineEnding?: LineEnding | null;
- /**
- * What's the max width of a line. Defaults to 80.
- */
- lineWidth?: LineWidth | null;
-}
-export interface OverrideLinterConfiguration {
- /**
- * if `false`, it disables the feature and the linter won't be executed. `true` by default
- */
- enabled?: boolean | null;
- /**
- * List of rules
- */
- rules?: Rules | null;
-}
-export interface OverrideOrganizeImportsConfiguration {
- /**
- * if `false`, it disables the feature and the linter won't be executed. `true` by default
- */
- enabled?: boolean | null;
-}
-/**
- * Set of properties to integrate Biome with a VCS software.
- */
-export interface VcsConfiguration {
- /**
- * The kind of client.
- */
- clientKind?: VcsClientKind | null;
- /**
- * The main branch of the project
- */
- defaultBranch?: string | null;
- /**
- * Whether Biome should integrate itself with the VCS client
- */
- enabled?: boolean | null;
- /**
- * The folder where Biome should check for VCS files. By default, Biome will use the same folder where `biome.json` was found.
- *
- * If Biome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Biome won't use the VCS integration, and a diagnostic will be emitted
- */
- root?: string | null;
- /**
- * Whether Biome should use the VCS ignore file. When [true], Biome will ignore the files specified in the ignore file.
- */
- useIgnoreFile?: boolean | null;
-}
diff --git a/packages/codemods/eslint/biome/migrate-rules/types/eslint.d.ts b/packages/codemods/eslint/biome/migrate-rules/types/eslint.d.ts
deleted file mode 100644
index 204cd2185..000000000
--- a/packages/codemods/eslint/biome/migrate-rules/types/eslint.d.ts
+++ /dev/null
@@ -1,8079 +0,0 @@
-/**
- * Apache License
- * Version 2.0, January 2004
- * http://www.apache.org/licenses/
- *
- * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
- *
- * 1. Definitions.
- *
- * "License" shall mean the terms and conditions for use, reproduction,
- * and distribution as defined by Sections 1 through 9 of this document.
- *
- * "Licensor" shall mean the copyright owner or entity authorized by
- * the copyright owner that is granting the License.
- *
- * "Legal Entity" shall mean the union of the acting entity and all
- * other entities that control, are controlled by, or are under common
- * control with that entity. For the purposes of this definition,
- * "control" means (i) the power, direct or indirect, to cause the
- * direction or management of such entity, whether by contract or
- * otherwise, or (ii) ownership of fifty percent (50%) or more of the
- * outstanding shares, or (iii) beneficial ownership of such entity.
- *
- * "You" (or "Your") shall mean an individual or Legal Entity
- * exercising permissions granted by this License.
- *
- * "Source" form shall mean the preferred form for making modifications,
- * including but not limited to software source code, documentation
- * source, and configuration files.
- *
- * "Object" form shall mean any form resulting from mechanical
- * transformation or translation of a Source form, including but
- * not limited to compiled object code, generated documentation,
- * and conversions to other media types.
- *
- * "Work" shall mean the work of authorship, whether in Source or
- * Object form, made available under the License, as indicated by a
- * copyright notice that is included in or attached to the work
- * (an example is provided in the Appendix below).
- *
- * "Derivative Works" shall mean any work, whether in Source or Object
- * form, that is based on (or derived from) the Work and for which the
- * editorial revisions, annotations, elaborations, or other modifications
- * represent, as a whole, an original work of authorship. For the purposes
- * of this License, Derivative Works shall not include works that remain
- * separable from, or merely link (or bind by name) to the interfaces of,
- * the Work and Derivative Works thereof.
- *
- * "Contribution" shall mean any work of authorship, including
- * the original version of the Work and any modifications or additions
- * to that Work or Derivative Works thereof, that is intentionally
- * submitted to Licensor for inclusion in the Work by the copyright owner
- * or by an individual or Legal Entity authorized to submit on behalf of
- * the copyright owner. For the purposes of this definition, "submitted"
- * means any form of electronic, verbal, or written communication sent
- * to the Licensor or its representatives, including but not limited to
- * communication on electronic mailing lists, source code control systems,
- * and issue tracking systems that are managed by, or on behalf of, the
- * Licensor for the purpose of discussing and improving the Work, but
- * excluding communication that is conspicuously marked or otherwise
- * designated in writing by the copyright owner as "Not a Contribution."
- *
- * "Contributor" shall mean Licensor and any individual or Legal Entity
- * on behalf of whom a Contribution has been received by Licensor and
- * subsequently incorporated within the Work.
- *
- * 2. Grant of Copyright License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * copyright license to reproduce, prepare Derivative Works of,
- * publicly display, publicly perform, sublicense, and distribute the
- * Work and such Derivative Works in Source or Object form.
- *
- * 3. Grant of Patent License. Subject to the terms and conditions of
- * this License, each Contributor hereby grants to You a perpetual,
- * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- * (except as stated in this section) patent license to make, have made,
- * use, offer to sell, sell, import, and otherwise transfer the Work,
- * where such license applies only to those patent claims licensable
- * by such Contributor that are necessarily infringed by their
- * Contribution(s) alone or by combination of their Contribution(s)
- * with the Work to which such Contribution(s) was submitted. If You
- * institute patent litigation against any entity (including a
- * cross-claim or counterclaim in a lawsuit) alleging that the Work
- * or a Contribution incorporated within the Work constitutes direct
- * or contributory patent infringement, then any patent licenses
- * granted to You under this License for that Work shall terminate
- * as of the date such litigation is filed.
- *
- * 4. Redistribution. You may reproduce and distribute copies of the
- * Work or Derivative Works thereof in any medium, with or without
- * modifications, and in Source or Object form, provided that You
- * meet the following conditions:
- *
- * (a) You must give any other recipients of the Work or
- * Derivative Works a copy of this License; and
- *
- * (b) You must cause any modified files to carry prominent notices
- * stating that You changed the files; and
- *
- * (c) You must retain, in the Source form of any Derivative Works
- * that You distribute, all copyright, patent, trademark, and
- * attribution notices from the Source form of the Work,
- * excluding those notices that do not pertain to any part of
- * the Derivative Works; and
- *
- * (d) If the Work includes a "NOTICE" text file as part of its
- * distribution, then any Derivative Works that You distribute must
- * include a readable copy of the attribution notices contained
- * within such NOTICE file, excluding those notices that do not
- * pertain to any part of the Derivative Works, in at least one
- * of the following places: within a NOTICE text file distributed
- * as part of the Derivative Works; within the Source form or
- * documentation, if provided along with the Derivative Works; or,
- * within a display generated by the Derivative Works, if and
- * wherever such third-party notices normally appear. The contents
- * of the NOTICE file are for informational purposes only and
- * do not modify the License. You may add Your own attribution
- * notices within Derivative Works that You distribute, alongside
- * or as an addendum to the NOTICE text from the Work, provided
- * that such additional attribution notices cannot be construed
- * as modifying the License.
- *
- * You may add Your own copyright statement to Your modifications and
- * may provide additional or different license terms and conditions
- * for use, reproduction, or distribution of Your modifications, or
- * for any such Derivative Works as a whole, provided Your use,
- * reproduction, and distribution of the Work otherwise complies with
- * the conditions stated in this License.
- *
- * 5. Submission of Contributions. Unless You explicitly state otherwise,
- * any Contribution intentionally submitted for inclusion in the Work
- * by You to the Licensor shall be under the terms and conditions of
- * this License, without any additional terms or conditions.
- * Notwithstanding the above, nothing herein shall supersede or modify
- * the terms of any separate license agreement you may have executed
- * with Licensor regarding such Contributions.
- *
- * 6. Trademarks. This License does not grant permission to use the trade
- * names, trademarks, service marks, or product names of the Licensor,
- * except as required for reasonable and customary use in describing the
- * origin of the Work and reproducing the content of the NOTICE file.
- *
- * 7. Disclaimer of Warranty. Unless required by applicable law or
- * agreed to in writing, Licensor provides the Work (and each
- * Contributor provides its Contributions) on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied, including, without limitation, any warranties or conditions
- * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- * PARTICULAR PURPOSE. You are solely responsible for determining the
- * appropriateness of using or redistributing the Work and assume any
- * risks associated with Your exercise of permissions under this License.
- *
- * 8. Limitation of Liability. In no event and under no legal theory,
- * whether in tort (including negligence), contract, or otherwise,
- * unless required by applicable law (such as deliberate and grossly
- * negligent acts) or agreed to in writing, shall any Contributor be
- * liable to You for damages, including any direct, indirect, special,
- * incidental, or consequential damages of any character arising as a
- * result of this License or out of the use or inability to use the
- * Work (including but not limited to damages for loss of goodwill,
- * work stoppage, computer failure or malfunction, or any and all
- * other commercial damages or losses), even if such Contributor
- * has been advised of the possibility of such damages.
- *
- * 9. Accepting Warranty or Additional Liability. While redistributing
- * the Work or Derivative Works thereof, You may choose to offer,
- * and charge a fee for, acceptance of support, warranty, indemnity,
- * or other liability obligations and/or rights consistent with this
- * License. However, in accepting such obligations, You may act only
- * on Your own behalf and on Your sole responsibility, not on behalf
- * of any other Contributor, and only if You agree to indemnify,
- * defend, and hold each Contributor harmless for any liability
- * incurred by, or claims asserted against, such Contributor by reason
- * of your accepting any such warranty or additional liability.
- *
- * END OF TERMS AND CONDITIONS
- *
- * APPENDIX: How to apply the Apache License to your work.
- *
- * To apply the Apache License to your work, attach the following
- * boilerplate notice, with the fields enclosed by brackets "[]"
- * replaced with your own identifying information. (Don't include
- * the brackets!) The text should be enclosed in the appropriate
- * comment syntax for the file format. We also recommend that a
- * file or class name and description of purpose be included on the
- * same "printed page" as the copyright notice for easier
- * identification within third-party archives.
- *
- * Copyright [yyyy] [name of copyright owner]
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * JSON Schema Store
- * Copyright 2015-Current Mads Kristensen and Contributors
- *
-*/
-/* eslint-disable */
-/**
- * This file was automatically generated by json-schema-to-typescript.
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
- * and run json-schema-to-typescript to regenerate this file.
- */
-
-/**
- * ESLint supports the use of third-party plugins. Before using the plugin, you have to install it using npm.
- */
-export type Plugins = string[];
-/**
- * ESLint comes with a large number of rules. You can modify which rules your project uses either using configuration comments or configuration files.
- */
-export type Rules = PossibleErrors &
- BestPractices &
- StrictMode &
- Variables &
- NodeAndCommonJs &
- StylisticIssues &
- EcmaScript6 &
- Legacy &
- HttpsJsonSchemastoreOrgPartialEslintPluginsJson;
-export type Rule = number | ("off" | "warn" | "error") | unknown[];
-/**
- * Allows to override configuration for files and folders, specified by glob patterns
- */
-export type Overrides = {
- /**
- * Glob pattern for files to apply 'overrides' configuration, relative to the directory of the config file
- */
- files: string | [string, ...string[]];
- /**
- * If you want to extend a specific configuration file, you can use the extends property and specify the path to the file. The path can be either relative or absolute.
- */
- extends?: string | string[];
- /**
- * If a file matches any of the 'excludedFiles' glob patterns, the 'overrides' configuration won't apply
- */
- excludedFiles?: string | string[];
- ecmaFeatures?: EcmaFeatures;
- env?: Env;
- globals?: Globals;
- parser?: string;
- parserOptions?: ParserOptions;
- plugins?: Plugins;
- /**
- * To specify a processor, specify the plugin name and processor name joined by a forward slash
- */
- processor?: string;
- rules?: Rules;
- settings?: Settings;
- overrides?: Overrides;
-}[];
-
-export interface JSONSchemaForESLintConfigurationFiles {
- ecmaFeatures?: EcmaFeatures;
- env?: Env;
- /**
- * If you want to extend a specific configuration file, you can use the extends property and specify the path to the file. The path can be either relative or absolute.
- */
- extends?: string | string[];
- globals?: Globals;
- /**
- * Prevent comments from changing config or rules
- */
- noInlineConfig?: boolean;
- parser?: string;
- parserOptions?: ParserOptions;
- plugins?: Plugins;
- /**
- * By default, ESLint will look for configuration files in all parent folders up to the root directory. This can be useful if you want all of your projects to follow a certain convention, but can sometimes lead to unexpected results. To limit ESLint to a specific project, set this to `true` in a configuration in the root of your project.
- */
- root?: boolean;
- /**
- * Tell ESLint to ignore specific files and directories. Each value uses the same pattern as the `.eslintignore` file.
- */
- ignorePatterns?: string | string[];
- rules?: Rules;
- settings?: Settings;
- overrides?: Overrides;
- [k: string]: unknown;
-}
-/**
- * By default, ESLint supports only ECMAScript 5 syntax. You can override that setting to enable support for ECMAScript 6 as well as JSX by using configuration settings.
- */
-export interface EcmaFeatures {
- arrowFunctions?: boolean;
- binaryLiterals?: boolean;
- blockBindings?: boolean;
- classes?: boolean;
- defaultParams?: boolean;
- destructuring?: boolean;
- /**
- * Enables support for the experimental object rest/spread properties (IMPORTANT: This is an experimental feature that may change significantly in the future. It's recommended that you do not write rules relying on this functionality unless you are willing to incur maintenance cost when it changes.)
- */
- experimentalObjectRestSpread?: boolean;
- forOf?: boolean;
- generators?: boolean;
- /**
- * allow return statements in the global scope
- */
- globalReturn?: boolean;
- /**
- * enable global strict mode (if ecmaVersion is 5 or greater)
- */
- impliedStrict?: boolean;
- /**
- * enable JSX
- */
- jsx?: boolean;
- modules?: boolean;
- objectLiteralComputedProperties?: boolean;
- objectLiteralDuplicateProperties?: boolean;
- objectLiteralShorthandMethods?: boolean;
- objectLiteralShorthandProperties?: boolean;
- octalLiterals?: boolean;
- regexUFlag?: boolean;
- regexYFlag?: boolean;
- restParams?: boolean;
- spread?: boolean;
- superInFunctions?: boolean;
- templateStrings?: boolean;
- unicodeCodePointEscapes?: boolean;
- [k: string]: unknown;
-}
-/**
- * An environment defines global variables that are predefined.
- */
-export interface Env {
- /**
- * defines require() and define() as global variables as per the amd spec
- */
- amd?: boolean;
- /**
- * AppleScript global variables
- */
- applescript?: boolean;
- /**
- * Atom test helper globals
- */
- atomtest?: boolean;
- /**
- * browser global variables
- */
- browser?: boolean;
- /**
- * CommonJS global variables and CommonJS scoping (use this for browser-only code that uses Browserify/WebPack)
- */
- commonjs?: boolean;
- /**
- * Globals common to both Node and Browser
- */
- "shared-node-browser"?: boolean;
- /**
- * Ember test helper globals
- */
- embertest?: boolean;
- /**
- * enable all ECMAScript 6 features except for modules
- */
- es6?: boolean;
- /**
- * GreaseMonkey globals
- */
- greasemonkey?: boolean;
- /**
- * adds all of the Jasmine testing global variables for version 1.3 and 2.0
- */
- jasmine?: boolean;
- /**
- * Jest global variables
- */
- jest?: boolean;
- /**
- * jQuery global variables
- */
- jquery?: boolean;
- /**
- * Meteor global variables
- */
- meteor?: boolean;
- /**
- * adds all of the Mocha test global variables
- */
- mocha?: boolean;
- /**
- * MongoDB global variables
- */
- mongo?: boolean;
- /**
- * Java 8 Nashorn global variables
- */
- nashorn?: boolean;
- /**
- * Node.js global variables and Node.js scoping
- */
- node?: boolean;
- /**
- * PhantomJS global variables
- */
- phantomjs?: boolean;
- /**
- * Prototype.js global variables
- */
- prototypejs?: boolean;
- /**
- * Protractor global variables
- */
- protractor?: boolean;
- /**
- * QUnit global variables
- */
- qunit?: boolean;
- /**
- * Service Worker global variables
- */
- serviceworker?: boolean;
- /**
- * ShellJS global variables
- */
- shelljs?: boolean;
- /**
- * WebExtensions globals
- */
- webextensions?: boolean;
- /**
- * web workers global variables
- */
- worker?: boolean;
- [k: string]: unknown;
-}
-/**
- * Set each global variable name equal to true to allow the variable to be overwritten or false to disallow overwriting.
- */
-export interface Globals {
- [k: string]: ("readonly" | "writable" | "off") | boolean;
-}
-/**
- * The JavaScript language options to be supported
- */
-export interface ParserOptions {
- ecmaFeatures?: EcmaFeatures;
- /**
- * Set to 3, 5, 6, 7, 8, 9, 10, 11 (default), 12, 13, 14 or "latest" to specify the version of ECMAScript syntax you want to use. You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), 2021 (same as 12), 2022 (same as 13) or 2023 (same as 14) to use the year-based naming. "latest" always enables the latest supported ECMAScript version.
- */
- ecmaVersion?:
- | 3
- | 5
- | 6
- | 2015
- | 7
- | 2016
- | 8
- | 2017
- | 9
- | 2018
- | 10
- | 2019
- | 11
- | 2020
- | 12
- | 2021
- | 13
- | 2022
- | 14
- | 2023
- | "latest";
- /**
- * set to "script" (default), "commonjs", or "module" if your code is in ECMAScript modules
- */
- sourceType?: "script" | "module" | "commonjs";
- [k: string]: unknown;
-}
-export interface PossibleErrors {
- /**
- * Require or disallow trailing commas
- */
- "comma-dangle"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce "for" loop update clause moving the counter in the right direction
- */
- "for-direction"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce return statements in getters
- */
- "getter-return"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow await inside of loops
- */
- "no-await-in-loop"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow comparing against -0
- */
- "no-compare-neg-zero"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow assignment operators in conditional expressions
- */
- "no-cond-assign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of console
- */
- "no-console"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow constant expressions in conditions
- */
- "no-constant-condition"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow control characters in regular expressions
- */
- "no-control-regex"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of debugger
- */
- "no-debugger"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow duplicate arguments in function definitions
- */
- "no-dupe-args"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow duplicate keys in object literals
- */
- "no-dupe-keys"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow duplicate case labels
- */
- "no-duplicate-case"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow empty block statements
- */
- "no-empty"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow empty character classes in regular expressions
- */
- "no-empty-character-class"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow reassigning exceptions in catch clauses
- */
- "no-ex-assign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary boolean casts
- */
- "no-extra-boolean-cast"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary parentheses
- */
- "no-extra-parens"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary semicolons
- */
- "no-extra-semi"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow reassigning function declarations
- */
- "no-func-assign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow function or var declarations in nested blocks
- */
- "no-inner-declarations"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow invalid regular expression strings in RegExp constructors
- */
- "no-invalid-regexp"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow irregular whitespace outside of strings and comments
- */
- "no-irregular-whitespace"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow negating the left operand in in expressions (deprecated)
- */
- "no-negated-in-lhs"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow calling global object properties as functions
- */
- "no-obj-calls"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow calling some Object.prototype methods directly on objects
- */
- "no-prototype-builtins"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow multiple spaces in regular expressions
- */
- "no-regex-spaces"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow sparse arrays
- */
- "no-sparse-arrays"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow template literal placeholder syntax in regular strings
- */
- "no-template-curly-in-string"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow confusing multiline expressions
- */
- "no-unexpected-multiline"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unreachable code after return, throw, continue, and break statements
- */
- "no-unreachable"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow control flow statements in finally blocks
- */
- "no-unsafe-finally"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow negating the left operand of relational operators
- */
- "no-unsafe-negation"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require calls to isNaN() when checking for NaN
- */
- "use-isnan"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce valid JSDoc comments
- */
- "valid-jsdoc"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce comparing typeof expressions against valid strings
- */
- "valid-typeof"?: number | ("off" | "warn" | "error") | unknown[];
- [k: string]: unknown;
-}
-export interface BestPractices {
- /**
- * Enforce getter and setter pairs in objects
- */
- "accessor-pairs"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce return statements in callbacks of array methods
- */
- "array-callback-return"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce the use of variables within the scope they are defined
- */
- "block-scoped-var"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce that class methods utilize this
- */
- "class-methods-use-this"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce a maximum cyclomatic complexity allowed in a program
- */
- complexity?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require return statements to either always or never specify values
- */
- "consistent-return"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent brace style for all control statements
- */
- curly?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require default cases in switch statements
- */
- "default-case"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent newlines before and after dots
- */
- "dot-location"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce dot notation whenever possible
- */
- "dot-notation"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require the use of === and !==
- */
- eqeqeq?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require for-in loops to include an if statement
- */
- "guard-for-in"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of alert, confirm, and prompt
- */
- "no-alert"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of arguments.caller or arguments.callee
- */
- "no-caller"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow lexical declarations in case clauses
- */
- "no-case-declarations"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow division operators explicitly at the beginning of regular expressions
- */
- "no-div-regex"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow else blocks after return statements in if statements
- */
- "no-else-return"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow empty functions
- */
- "no-empty-function"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow empty destructuring patterns
- */
- "no-empty-pattern"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow null comparisons without type-checking operators
- */
- "no-eq-null"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of eval()
- */
- "no-eval"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow extending native types
- */
- "no-extend-native"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary calls to .bind()
- */
- "no-extra-bind"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary labels
- */
- "no-extra-label"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow fallthrough of case statements
- */
- "no-fallthrough"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow leading or trailing decimal points in numeric literals
- */
- "no-floating-decimal"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow assignments to native objects or read-only global variables
- */
- "no-global-assign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow shorthand type conversions
- */
- "no-implicit-coercion"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow var and named function declarations in the global scope
- */
- "no-implicit-globals"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of eval()-like methods
- */
- "no-implied-eval"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow this keywords outside of classes or class-like objects
- */
- "no-invalid-this"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of the __iterator__ property
- */
- "no-iterator"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow labeled statements
- */
- "no-labels"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary nested blocks
- */
- "no-lone-blocks"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow function declarations and expressions inside loop statements
- */
- "no-loop-func"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow magic numbers
- */
- "no-magic-numbers"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow multiple spaces
- */
- "no-multi-spaces"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow multiline strings
- */
- "no-multi-str"?: number | ("off" | "warn" | "error") | unknown[];
- "no-native-reassign"?: Rule;
- /**
- * Disallow new operators outside of assignments or comparisons
- */
- "no-new"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow new operators with the Function object
- */
- "no-new-func"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow new operators with the String, Number, and Boolean objects
- */
- "no-new-wrappers"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow octal literals
- */
- "no-octal"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow octal escape sequences in string literals
- */
- "no-octal-escape"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow reassigning function parameters
- */
- "no-param-reassign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of the __proto__ property
- */
- "no-proto"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow var redeclaration
- */
- "no-redeclare"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow certain properties on certain objects
- */
- "no-restricted-properties"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow assignment operators in return statements
- */
- "no-return-assign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary return await
- */
- "no-return-await"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow javascript: urls
- */
- "no-script-url"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow assignments where both sides are exactly the same
- */
- "no-self-assign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow comparisons where both sides are exactly the same
- */
- "no-self-compare"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow comma operators
- */
- "no-sequences"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow throwing literals as exceptions
- */
- "no-throw-literal"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unmodified loop conditions
- */
- "no-unmodified-loop-condition"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unused expressions
- */
- "no-unused-expressions"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unused labels
- */
- "no-unused-labels"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary calls to .call() and .apply()
- */
- "no-useless-call"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary concatenation of literals or template literals
- */
- "no-useless-concat"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary escape characters
- */
- "no-useless-escape"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow redundant return statements
- */
- "no-useless-return"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow void operators
- */
- "no-void"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow specified warning terms in comments
- */
- "no-warning-comments"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow with statements
- */
- "no-with"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require using Error objects as Promise rejection reasons
- */
- "prefer-promise-reject-errors"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce the consistent use of the radix argument when using parseInt()
- */
- radix?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow async functions which have no await expression
- */
- "require-await"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require var declarations be placed at the top of their containing scope
- */
- "vars-on-top"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require parentheses around immediate function invocations
- */
- "wrap-iife"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or Disallow "Yoda" conditions
- */
- yoda?: number | ("off" | "warn" | "error") | unknown[];
- [k: string]: unknown;
-}
-export interface StrictMode {
- /**
- * require or disallow strict mode directives
- */
- strict?: number | ("off" | "warn" | "error") | unknown[];
- [k: string]: unknown;
-}
-export interface Variables {
- /**
- * Require or disallow initialization in var declarations
- */
- "init-declarations"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow catch clause parameters from shadowing variables in the outer scope
- */
- "no-catch-shadow"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow deleting variables
- */
- "no-delete-var"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow labels that share a name with a variable
- */
- "no-label-var"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow specified global variables
- */
- "no-restricted-globals"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow var declarations from shadowing variables in the outer scope
- */
- "no-shadow"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow identifiers from shadowing restricted names
- */
- "no-shadow-restricted-names"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of undeclared variables unless mentioned in /*global * / comments
- */
- "no-undef"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of undefined as an identifier
- */
- "no-undefined"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow initializing variables to undefined
- */
- "no-undef-init"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unused variables
- */
- "no-unused-vars"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of variables before they are defined
- */
- "no-use-before-define"?: number | ("off" | "warn" | "error") | unknown[];
- [k: string]: unknown;
-}
-export interface NodeAndCommonJs {
- /**
- * Require return statements after callbacks
- */
- "callback-return"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require require() calls to be placed at top-level module scope
- */
- "global-require"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require error handling in callbacks
- */
- "handle-callback-err"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow use of the Buffer() constructor
- */
- "no-buffer-constructor"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow require calls to be mixed with regular var declarations
- */
- "no-mixed-requires"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow new operators with calls to require
- */
- "no-new-require"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow string concatenation with __dirname and __filename
- */
- "no-path-concat"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of process.env
- */
- "no-process-env"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the use of process.exit()
- */
- "no-process-exit"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow specified modules when loaded by require
- */
- "no-restricted-modules"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow synchronous methods
- */
- "no-sync"?: number | ("off" | "warn" | "error") | unknown[];
- [k: string]: unknown;
-}
-export interface StylisticIssues {
- /**
- * Enforce line breaks after opening and before closing array brackets
- */
- "array-bracket-newline"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing inside array brackets
- */
- "array-bracket-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce line breaks after each array element
- */
- "array-element-newline"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing inside single-line blocks
- */
- "block-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent brace style for blocks
- */
- "brace-style"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce camelcase naming convention
- */
- camelcase?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce or disallow capitalization of the first letter of a comment
- */
- "capitalized-comments"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow trailing commas
- */
- "comma-dangle"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing before and after commas
- */
- "comma-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent comma style
- */
- "comma-style"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing inside computed property brackets
- */
- "computed-property-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent naming when capturing the current execution context
- */
- "consistent-this"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce at least one newline at the end of files
- */
- "eol-last"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow spacing between function identifiers and their invocations
- */
- "func-call-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require function names to match the name of the variable or property to which they are assigned
- */
- "func-name-matching"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow named function expressions
- */
- "func-names"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce the consistent use of either function declarations or expressions
- */
- "func-style"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce line breaks between arguments of a function call
- */
- "function-call-argument-newline"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent line breaks inside function parentheses
- */
- "function-paren-newline"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow specified identifiers
- */
- "id-blacklist"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce minimum and maximum identifier lengths
- */
- "id-length"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require identifiers to match a specified regular expression
- */
- "id-match"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce the location of arrow function bodies
- */
- "implicit-arrow-linebreak"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent indentation
- */
- indent?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent indentation (legacy, deprecated)
- */
- "indent-legacy"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce the consistent use of either double or single quotes in JSX attributes
- */
- "jsx-quotes"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing between keys and values in object literal properties
- */
- "key-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing before and after keywords
- */
- "keyword-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce position of line comments
- */
- "line-comment-position"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow an empty line between class members
- */
- "lines-between-class-members"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent linebreak style
- */
- "linebreak-style"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require empty lines around comments
- */
- "lines-around-comment"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow newlines around directives
- */
- "lines-around-directive"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce a maximum depth that blocks can be nested
- */
- "max-depth"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce a maximum line length
- */
- "max-len"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce a maximum number of lines per file
- */
- "max-lines"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce a maximum depth that callbacks can be nested
- */
- "max-nested-callbacks"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce a maximum number of parameters in function definitions
- */
- "max-params"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce a maximum number of statements allowed in function blocks
- */
- "max-statements"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce a maximum number of statements allowed per line
- */
- "max-statements-per-line"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce a particular style for multiline comments
- */
- "multiline-comment-style"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce newlines between operands of ternary expressions
- */
- "multiline-ternary"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require constructor function names to begin with a capital letter
- */
- "new-cap"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow an empty line after var declarations
- */
- "newline-after-var"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require an empty line before return statements
- */
- "newline-before-return"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require a newline after each call in a method chain
- */
- "newline-per-chained-call"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require parentheses when invoking a constructor with no arguments
- */
- "new-parens"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow Array constructors
- */
- "no-array-constructor"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow bitwise operators
- */
- "no-bitwise"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow continue statements
- */
- "no-continue"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow inline comments after code
- */
- "no-inline-comments"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow if statements as the only statement in else blocks
- */
- "no-lonely-if"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow mixed binary operators
- */
- "no-mixed-operators"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow mixed spaces and tabs for indentation
- */
- "no-mixed-spaces-and-tabs"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow use of chained assignment expressions
- */
- "no-multi-assign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow multiple empty lines
- */
- "no-multiple-empty-lines"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow negated conditions
- */
- "no-negated-condition"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow nested ternary expressions
- */
- "no-nested-ternary"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow Object constructors
- */
- "no-new-object"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow the unary operators ++ and --
- */
- "no-plusplus"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow specified syntax
- */
- "no-restricted-syntax"?: number | ("off" | "warn" | "error") | unknown[];
- "no-spaced-func"?: Rule;
- /**
- * Disallow tabs in file
- */
- "no-tabs"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow ternary operators
- */
- "no-ternary"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow trailing whitespace at the end of lines
- */
- "no-trailing-spaces"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow dangling underscores in identifiers
- */
- "no-underscore-dangle"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow ternary operators when simpler alternatives exist
- */
- "no-unneeded-ternary"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow whitespace before properties
- */
- "no-whitespace-before-property"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce the location of single-line statements
- */
- "nonblock-statement-body-position"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent line breaks inside braces
- */
- "object-curly-newline"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing inside braces
- */
- "object-curly-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce placing object properties on separate lines
- */
- "object-property-newline"?: number | ("off" | "warn" | "error") | unknown[];
- "object-shorthand"?: Rule;
- /**
- * Enforce variables to be declared either together or separately in functions
- */
- "one-var"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow newlines around var declarations
- */
- "one-var-declaration-per-line"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow assignment operator shorthand where possible
- */
- "operator-assignment"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent linebreak style for operators
- */
- "operator-linebreak"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow padding within blocks
- */
- "padded-blocks"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow padding lines between statements
- */
- "padding-line-between-statements"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require quotes around object literal property names
- */
- "quote-props"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce the consistent use of either backticks, double, or single quotes
- */
- quotes?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require JSDoc comments
- */
- "require-jsdoc"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow semicolons instead of ASI
- */
- semi?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing before and after semicolons
- */
- "semi-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce location of semicolons
- */
- "semi-style"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Requires object keys to be sorted
- */
- "sort-keys"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require variables within the same declaration block to be sorted
- */
- "sort-vars"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing before blocks
- */
- "space-before-blocks"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing before function definition opening parenthesis
- */
- "space-before-function-paren"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing after the // or /* in a comment
- */
- "spaced-comment"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require spacing around operators
- */
- "space-infix-ops"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing inside parentheses
- */
- "space-in-parens"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing before or after unary operators
- */
- "space-unary-ops"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce spacing around colons of switch statements
- */
- "switch-colon-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow spacing between template tags and their literals
- */
- "template-tag-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow Unicode byte order mark (BOM)
- */
- "unicode-bom"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require parenthesis around regex literals
- */
- "wrap-regex"?: number | ("off" | "warn" | "error") | unknown[];
- [k: string]: unknown;
-}
-export interface EcmaScript6 {
- /**
- * Require braces around arrow function bodies
- */
- "arrow-body-style"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require parentheses around arrow function arguments
- */
- "arrow-parens"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing before and after the arrow in arrow functions
- */
- "arrow-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require super() calls in constructors
- */
- "constructor-super"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce consistent spacing around * operators in generator functions
- */
- "generator-star-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow reassigning class members
- */
- "no-class-assign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow arrow functions where they could be confused with comparisons
- */
- "no-confusing-arrow"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow reassigning const variables
- */
- "no-const-assign"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow duplicate class members
- */
- "no-dupe-class-members"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow duplicate module imports
- */
- "no-duplicate-imports"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow new operators with the Symbol object
- */
- "no-new-symbol"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow specified modules when loaded by import
- */
- "no-restricted-imports"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow this/super before calling super() in constructors
- */
- "no-this-before-super"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary computed property keys in object literals
- */
- "no-useless-computed-key"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow unnecessary constructors
- */
- "no-useless-constructor"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow renaming import, export, and destructured assignments to the same name
- */
- "no-useless-rename"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require let or const instead of var
- */
- "no-var"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow method and property shorthand syntax for object literals
- */
- "object-shorthand"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require arrow functions as callbacks
- */
- "prefer-arrow-callback"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require const declarations for variables that are never reassigned after declared
- */
- "prefer-const"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require destructuring from arrays and/or objects
- */
- "prefer-destructuring"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Disallow parseInt() in favor of binary, octal, and hexadecimal literals
- */
- "prefer-numeric-literals"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require Reflect methods where applicable
- */
- "prefer-reflect"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require rest parameters instead of arguments
- */
- "prefer-rest-params"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require spread operators instead of .apply()
- */
- "prefer-spread"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require template literals instead of string concatenation
- */
- "prefer-template"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require generator functions to contain yield
- */
- "require-yield"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce spacing between rest and spread operators and their expressions
- */
- "rest-spread-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Enforce sorted import declarations within modules
- */
- "sort-imports"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require symbol descriptions
- */
- "symbol-description"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow spacing around embedded expressions of template strings
- */
- "template-curly-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- /**
- * Require or disallow spacing around the * in yield* expressions
- */
- "yield-star-spacing"?: number | ("off" | "warn" | "error") | unknown[];
- [k: string]: unknown;
-}
-export interface Legacy {
- "max-depth"?: Rule;
- "max-len"?: Rule;
- "max-params"?: Rule;
- "max-statements"?: Rule;
- "no-bitwise"?: Rule;
- "no-plusplus"?: Rule;
- [k: string]: unknown;
-}
-export interface HttpsJsonSchemastoreOrgPartialEslintPluginsJson {
- /**
- * Classes decorated with @Component must have suffix "Component" (or custom) in their name. See more at https://angular.io/styleguide#style-02-03
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/component-class-suffix.md
- */
- "angular-eslint/component-class-suffix"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- suffixes?: string[];
- }
- ];
- /**
- * Enforces a maximum number of lines in inline template, styles and animations. See more at https://angular.io/guide/styleguide#style-05-04
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/component-max-inline-declarations.md
- */
- "angular-eslint/component-max-inline-declarations"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- template?: number;
- styles?: number;
- animations?: number;
- }
- ];
- /**
- * Component selectors should follow given naming rules. See more at https://angular.io/guide/styleguide#style-02-07, https://angular.io/guide/styleguide#style-05-02
- * and https://angular.io/guide/styleguide#style-05-03.
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/component-selector.md
- */
- "angular-eslint/component-selector"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- type?: string | ("element" | "attribute")[];
- prefix?: string | unknown[];
- style?: "camelCase" | "kebab-case";
- }
- ];
- /**
- * Ensures that classes use contextual decorators in its body
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/contextual-decorator.md
- */
- "angular-eslint/contextual-decorator"?: {
- [k: string]: unknown;
- };
- /**
- * Ensures that lifecycle methods are used in a correct context
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/contextual-lifecycle.md
- */
- "angular-eslint/contextual-lifecycle"?: {
- [k: string]: unknown;
- };
- /**
- * Classes decorated with @Directive must have suffix "Directive" (or custom) in their name. See more at https://angular.io/styleguide#style-02-03
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/directive-class-suffix.md
- */
- "angular-eslint/directive-class-suffix"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- suffixes?: string[];
- }
- ];
- /**
- * Directive selectors should follow given naming rules. See more at https://angular.io/guide/styleguide#style-02-06 and https://angular.io/guide/styleguide#style-02-08.
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/directive-selector.md
- */
- "angular-eslint/directive-selector"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- type?: string | ("element" | "attribute")[];
- prefix?: string | unknown[];
- style?: "camelCase" | "kebab-case";
- }
- ];
- /**
- * The @Attribute decorator is used to obtain a single value for an attribute. This is a much less common use-case than getting a stream of values (using @Input), so often the @Attribute decorator is mistakenly used when @Input was what was intended. This rule disallows usage of @Attribute decorator altogether in order to prevent these mistakes.
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-attribute-decorator.md
- */
- "angular-eslint/no-attribute-decorator"?: {
- [k: string]: unknown;
- };
- /**
- * Ensures that directives not implement conflicting lifecycle interfaces.
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-conflicting-lifecycle.md
- */
- "angular-eslint/no-conflicting-lifecycle"?: {
- [k: string]: unknown;
- };
- /**
- * Disallows declaring empty lifecycle methods
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-empty-lifecycle-method.md
- */
- "angular-eslint/no-empty-lifecycle-method"?: {
- [k: string]: unknown;
- };
- /**
- * Disallows usage of `forwardRef` references for DI
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-forward-ref.md
- */
- "angular-eslint/no-forward-ref"?: {
- [k: string]: unknown;
- };
- /**
- * Disallows usage of the `host` metadata property. See more at https://angular.io/styleguide#style-06-03
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-host-metadata-property.md
- */
- "angular-eslint/no-host-metadata-property"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- allowStatic?: boolean;
- }
- ];
- /**
- * Ensures that input bindings, including aliases, are not named or prefixed by the configured disallowed prefixes
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-input-prefix.md
- */
- "angular-eslint/no-input-prefix"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- prefixes?: string[];
- }
- ];
- /**
- * Ensures that input bindings are not aliased
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-input-rename.md
- */
- "angular-eslint/no-input-rename"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * A list with allowed input names
- */
- allowedNames?: string[];
- }
- ];
- /**
- * Disallows usage of the `inputs` metadata property. See more at https://angular.io/styleguide#style-05-12
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-inputs-metadata-property.md
- */
- "angular-eslint/no-inputs-metadata-property"?: {
- [k: string]: unknown;
- };
- /**
- * Disallows explicit calls to lifecycle methods
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-lifecycle-call.md
- */
- "angular-eslint/no-lifecycle-call"?: {
- [k: string]: unknown;
- };
- /**
- * Ensures that output bindings, including aliases, are not named as standard DOM events
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-output-native.md
- */
- "angular-eslint/no-output-native"?: {
- [k: string]: unknown;
- };
- /**
- * Ensures that output bindings, including aliases, are not named "on", nor prefixed with it. See more at https://angular.io/guide/styleguide#style-05-16
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-output-on-prefix.md
- */
- "angular-eslint/no-output-on-prefix"?: {
- [k: string]: unknown;
- };
- /**
- * Ensures that output bindings are not aliased
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-output-rename.md
- */
- "angular-eslint/no-output-rename"?: {
- [k: string]: unknown;
- };
- /**
- * Disallows usage of the `outputs` metadata property. See more at https://angular.io/styleguide#style-05-12
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-outputs-metadata-property.md
- */
- "angular-eslint/no-outputs-metadata-property"?: {
- [k: string]: unknown;
- };
- /**
- * Disallows the declaration of impure pipes
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-pipe-impure.md
- */
- "angular-eslint/no-pipe-impure"?: {
- [k: string]: unknown;
- };
- /**
- * Disallows usage of the `queries` metadata property. See more at https://angular.io/styleguide#style-05-12.
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/no-queries-metadata-property.md
- */
- "angular-eslint/no-queries-metadata-property"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce consistent prefix for pipes.
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/pipe-prefix.md
- */
- "angular-eslint/pipe-prefix"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- prefixes?: string[];
- }
- ];
- /**
- * Ensures component's `changeDetection` is set to `ChangeDetectionStrategy.OnPush`
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-on-push-component-change-detection.md
- */
- "angular-eslint/prefer-on-push-component-change-detection"?: {
- [k: string]: unknown;
- };
- /**
- * Ensures component `standalone` property is set to `true` in the component decorator
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-standalone-component.md
- */
- "angular-eslint/prefer-standalone-component"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer to declare `@Output` as `readonly` since they are not supposed to be reassigned
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-output-readonly.md
- */
- "angular-eslint/prefer-output-readonly"?: {
- [k: string]: unknown;
- };
- /**
- * The ./ and ../ prefix is standard syntax for relative URLs; don't depend on Angular's current ability to do without that prefix. See more at https://angular.io/styleguide#style-05-04
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/relative-url-prefix.md
- */
- "angular-eslint/relative-url-prefix"?: {
- [k: string]: unknown;
- };
- /**
- * Ensures that $localize tagged messages contain helpful metadata to aid with translations.
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/require-localize-metadata.md
- */
- "angular-eslint/require-localize-metadata"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- requireDescription?: boolean;
- requireMeaning?: boolean;
- }
- ];
- /**
- * Ensures that lifecycle methods are declared in order of execution
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/sort-lifecycle-methods.md
- */
- "angular-eslint/sort-lifecycle-methods"?: {
- [k: string]: unknown;
- };
- /**
- * Ensures ASC alphabetical order for `NgModule` metadata arrays for easy visual scanning
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/sort-ngmodule-metadata-arrays.md
- */
- "angular-eslint/sort-ngmodule-metadata-arrays"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * A string with a BCP 47 language tag.
- */
- locale?: string;
- }
- ];
- /**
- * Component selector must be declared
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-component-selector.md
- */
- "angular-eslint/use-component-selector"?: {
- [k: string]: unknown;
- };
- /**
- * Disallows using `ViewEncapsulation.None`
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-component-view-encapsulation.md
- */
- "angular-eslint/use-component-view-encapsulation"?: {
- [k: string]: unknown;
- };
- /**
- * Using the `providedIn` property makes `Injectables` tree-shakable
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-injectable-provided-in.md
- */
- "angular-eslint/use-injectable-provided-in"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- ignoreClassNamePattern?: string;
- }
- ];
- /**
- * Ensures that classes implement lifecycle interfaces corresponding to the declared lifecycle methods. See more at https://angular.io/styleguide#style-09-01
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-lifecycle-interface.md
- */
- "angular-eslint/use-lifecycle-interface"?: {
- [k: string]: unknown;
- };
- /**
- * Ensures that `Pipes` implement `PipeTransform` interface
- * https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-pipe-transform-interface.md
- */
- "angular-eslint/use-pipe-transform-interface"?: {
- [k: string]: unknown;
- };
- /**
- * Ensure imports point to a file/module that can be resolved.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-unresolved.md
- */
- "eslint-plugin-import/no-unresolved"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- commonjs?: boolean;
- amd?: boolean;
- esmodule?: boolean;
- /**
- * @minItems 1
- */
- ignore?: [string, ...string[]];
- caseSensitive?: boolean;
- caseSensitiveStrict?: boolean;
- }
- ];
- /**
- * Ensure named imports correspond to a named export in the remote file.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/named.md
- */
- "eslint-plugin-import/named"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- commonjs?: boolean;
- }
- ];
- /**
- * Ensure a default export is present, given a default import.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/default.md
- */
- "eslint-plugin-import/default"?: {
- [k: string]: unknown;
- };
- /**
- * Ensure imported namespaces contain dereferenced properties as they are dereferenced.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/namespace.md
- */
- "eslint-plugin-import/namespace"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * If `false`, will report computed (and thus, un-lintable) references to namespace members.
- */
- allowComputed?: boolean;
- }
- ];
- /**
- * Forbid namespace (a.k.a. "wildcard" `*`) imports.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-namespace.md
- */
- "eslint-plugin-import/no-namespace"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- ignore?: string[];
- }
- ];
- /**
- * Forbid any invalid exports, i.e. re-export of the same name.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/export.md
- */
- "eslint-plugin-import/export"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid the use of mutable exports with `var` or `let`.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-mutable-exports.md
- */
- "eslint-plugin-import/no-mutable-exports"?: {
- [k: string]: unknown;
- };
- /**
- * Ensure consistent use of file extension within the import path.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/extensions.md
- */
- "eslint-plugin-import/extensions"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce which files can be imported in a given folder.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-restricted-paths.md
- */
- "eslint-plugin-import/no-restricted-paths"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * @minItems 1
- */
- zones?: [
- {
- target?: string | [string, ...string[]];
- from?: string | [string, ...string[]];
- except?: string[];
- message?: string;
- },
- ...{
- target?: string | [string, ...string[]];
- from?: string | [string, ...string[]];
- except?: string[];
- message?: string;
- }[]
- ];
- basePath?: string;
- }
- ];
- /**
- * Forbid importing the submodules of other modules.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-internal-modules.md
- */
- "eslint-plugin-import/no-internal-modules"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Prefer named exports to be grouped together in a single export declaration
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/group-exports.md
- */
- "eslint-plugin-import/group-exports"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid importing packages through relative paths.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-relative-packages.md
- */
- "eslint-plugin-import/no-relative-packages"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- commonjs?: boolean;
- amd?: boolean;
- esmodule?: boolean;
- /**
- * @minItems 1
- */
- ignore?: [string, ...string[]];
- }
- ];
- /**
- * Forbid importing modules from parent directories.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-relative-parent-imports.md
- */
- "eslint-plugin-import/no-relative-parent-imports"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- commonjs?: boolean;
- amd?: boolean;
- esmodule?: boolean;
- /**
- * @minItems 1
- */
- ignore?: [string, ...string[]];
- }
- ];
- /**
- * Enforce or ban the use of inline type-only markers for named imports.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/consistent-type-specifier-style.md
- */
- "eslint-plugin-import/consistent-type-specifier-style"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Forbid a module from importing itself.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-self-import.md
- */
- "eslint-plugin-import/no-self-import"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid a module from importing a module with a dependency path back to itself.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-cycle.md
- */
- "eslint-plugin-import/no-cycle"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- commonjs?: boolean;
- amd?: boolean;
- esmodule?: boolean;
- /**
- * @minItems 1
- */
- ignore?: [string, ...string[]];
- maxDepth?: number | "∞";
- /**
- * ignore external modules
- */
- ignoreExternal?: boolean;
- /**
- * Allow cyclic dependency if there is at least one dynamic import in the chain
- */
- allowUnsafeDynamicCyclicDependency?: boolean;
- }
- ];
- /**
- * Forbid named default exports.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-named-default.md
- */
- "eslint-plugin-import/no-named-default"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid use of exported name as identifier of default export.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-named-as-default.md
- */
- "eslint-plugin-import/no-named-as-default"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid use of exported name as property of default export.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-named-as-default-member.md
- */
- "eslint-plugin-import/no-named-as-default-member"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid anonymous values as default exports.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-anonymous-default-export.md
- */
- "eslint-plugin-import/no-anonymous-default-export"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * If `false`, will report default export of an array
- */
- allowArray?: boolean;
- /**
- * If `false`, will report default export of an arrow function
- */
- allowArrowFunction?: boolean;
- /**
- * If `false`, will report default export of a function call
- */
- allowCallExpression?: boolean;
- /**
- * If `false`, will report default export of an anonymous class
- */
- allowAnonymousClass?: boolean;
- /**
- * If `false`, will report default export of an anonymous function
- */
- allowAnonymousFunction?: boolean;
- /**
- * If `false`, will report default export of a literal
- */
- allowLiteral?: boolean;
- /**
- * If `false`, will report default export of an object expression
- */
- allowObject?: boolean;
- /**
- * If `false`, will report default export of a class instantiation
- */
- allowNew?: boolean;
- }
- ];
- /**
- * Forbid modules without exports, or exports without matching import in another module.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-unused-modules.md
- */
- "eslint-plugin-import/no-unused-modules"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * files/paths to be analyzed (only for unused exports)
- */
- src?: string[];
- /**
- * files/paths for which unused exports will not be reported (e.g module entry points)
- */
- ignoreExports?: string[];
- /**
- * report modules without any exports
- */
- missingExports?: boolean;
- /**
- * report exports without any usage
- */
- unusedExports?: boolean;
- }
- ];
- /**
- * Forbid CommonJS `require` calls and `module.exports` or `exports.*`.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-commonjs.md
- */
- "eslint-plugin-import/no-commonjs"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid AMD `require` and `define` calls.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-amd.md
- */
- "eslint-plugin-import/no-amd"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid repeated import of the same module in multiple places.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-duplicates.md
- */
- "eslint-plugin-import/no-duplicates"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- considerQueryString?: boolean;
- "prefer-inline"?: boolean;
- }
- ];
- /**
- * Ensure all imports appear before other statements.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/first.md
- */
- "eslint-plugin-import/first"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * Enforce the maximum number of dependencies a module can have.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/max-dependencies.md
- */
- "eslint-plugin-import/max-dependencies"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- max?: number;
- ignoreTypeImports?: boolean;
- }
- ];
- /**
- * Forbid the use of extraneous packages.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-extraneous-dependencies.md
- */
- "eslint-plugin-import/no-extraneous-dependencies"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- devDependencies?: boolean | unknown[];
- optionalDependencies?: boolean | unknown[];
- peerDependencies?: boolean | unknown[];
- bundledDependencies?: boolean | unknown[];
- packageDir?: string | unknown[];
- includeInternal?: boolean;
- includeTypes?: boolean;
- }
- ];
- /**
- * Forbid import of modules using absolute paths.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-absolute-path.md
- */
- "eslint-plugin-import/no-absolute-path"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- commonjs?: boolean;
- amd?: boolean;
- esmodule?: boolean;
- /**
- * @minItems 1
- */
- ignore?: [string, ...string[]];
- }
- ];
- /**
- * Forbid Node.js builtin modules.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-nodejs-modules.md
- */
- "eslint-plugin-import/no-nodejs-modules"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- allow?: string[];
- }
- ];
- /**
- * Forbid webpack loader syntax in imports.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-webpack-loader-syntax.md
- */
- "eslint-plugin-import/no-webpack-loader-syntax"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce a convention in module import order.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/order.md
- */
- "eslint-plugin-import/order"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- groups?: unknown[];
- pathGroupsExcludedImportTypes?: unknown[];
- distinctGroup?: boolean;
- pathGroups?: {
- pattern: string;
- patternOptions?: {
- [k: string]: unknown;
- };
- group: "builtin" | "external" | "internal" | "unknown" | "parent" | "sibling" | "index" | "object" | "type";
- position?: "after" | "before";
- }[];
- "newlines-between"?: "ignore" | "always" | "always-and-inside-groups" | "never";
- alphabetize?: {
- caseInsensitive?: boolean;
- order?: "ignore" | "asc" | "desc";
- orderImportKind?: "ignore" | "asc" | "desc";
- };
- warnOnUnassignedImports?: boolean;
- }
- ];
- /**
- * Enforce a newline after import statements.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/newline-after-import.md
- */
- "eslint-plugin-import/newline-after-import"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- count?: number;
- exactCount?: boolean;
- considerComments?: boolean;
- }
- ];
- /**
- * Prefer a default export if module exports a single name or multiple names.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/prefer-default-export.md
- */
- "eslint-plugin-import/prefer-default-export"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- target?: "single" | "any";
- }
- ];
- /**
- * Forbid default exports.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-default-export.md
- */
- "eslint-plugin-import/no-default-export"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid named exports.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-named-export.md
- */
- "eslint-plugin-import/no-named-export"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid `require()` calls with expressions.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-dynamic-require.md
- */
- "eslint-plugin-import/no-dynamic-require"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- esmodule?: boolean;
- }
- ];
- /**
- * Forbid potentially ambiguous parse goal (`script` vs. `module`).
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/unambiguous.md
- */
- "eslint-plugin-import/unambiguous"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid unassigned imports
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-unassigned-import.md
- */
- "eslint-plugin-import/no-unassigned-import"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- devDependencies?: boolean | unknown[];
- optionalDependencies?: boolean | unknown[];
- peerDependencies?: boolean | unknown[];
- allow?: string[];
- }
- ];
- /**
- * Forbid unnecessary path segments in import and require statements.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-useless-path-segments.md
- */
- "eslint-plugin-import/no-useless-path-segments"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- commonjs?: boolean;
- noUselessIndex?: boolean;
- }
- ];
- /**
- * Enforce a leading comment with the webpackChunkName for dynamic imports.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/dynamic-import-chunkname.md
- */
- "eslint-plugin-import/dynamic-import-chunkname"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- importFunctions?: string[];
- webpackChunknameFormat?: string;
- }
- ];
- /**
- * Forbid import statements with CommonJS module.exports.
- *
- */
- "eslint-plugin-import/no-import-module-exports"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- exceptions?: unknown[];
- }
- ];
- /**
- * Forbid empty named import blocks.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-empty-named-blocks.md
- */
- "eslint-plugin-import/no-empty-named-blocks"?: {
- [k: string]: unknown;
- };
- /**
- * Ensure all exports appear after other statements.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/exports-last.md
- */
- "eslint-plugin-import/exports-last"?: {
- [k: string]: unknown;
- };
- /**
- * Forbid imported names marked with `@deprecated` documentation tag.
- * https://github.com/import-js/eslint-plugin-import/blob/v2.29.0/docs/rules/no-deprecated.md
- */
- "eslint-plugin-import/no-deprecated"?: {
- [k: string]: unknown;
- };
- /**
- * Replaced by `import/first`.
- * https://github.com/import-js/eslint-plugin-import/blob/7b25c1cb95ee18acc1531002fd343e1e6031f9ed/docs/rules/imports-first.md
- */
- "eslint-plugin-import/imports-first"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Improve regexes by making them shorter, consistent, and safer.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/better-regex.md
- */
- "eslint-plugin-unicorn/better-regex"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- sortCharacterClasses?: boolean;
- }
- ];
- /**
- * Enforce a specific parameter name in catch clauses.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/catch-error-name.md
- */
- "eslint-plugin-unicorn/catch-error-name"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- name?: string;
- ignore?: unknown[];
- }
- ];
- /**
- * Use destructured variables over properties.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/consistent-destructuring.md
- */
- "eslint-plugin-unicorn/consistent-destructuring"?: {
- [k: string]: unknown;
- };
- /**
- * Move function definitions to the highest possible scope.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/consistent-function-scoping.md
- */
- "eslint-plugin-unicorn/consistent-function-scoping"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- checkArrowFunctions?: boolean;
- }
- ];
- /**
- * Enforce correct `Error` subclassing.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/custom-error-definition.md
- */
- "eslint-plugin-unicorn/custom-error-definition"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce no spaces between braces.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/empty-brace-spaces.md
- */
- "eslint-plugin-unicorn/empty-brace-spaces"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce passing a `message` value when creating a built-in error.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/error-message.md
- */
- "eslint-plugin-unicorn/error-message"?: {
- [k: string]: unknown;
- };
- /**
- * Require escape sequences to use uppercase values.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/escape-case.md
- */
- "eslint-plugin-unicorn/escape-case"?: {
- [k: string]: unknown;
- };
- /**
- * Add expiration conditions to TODO comments.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/expiring-todo-comments.md
- */
- "eslint-plugin-unicorn/expiring-todo-comments"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- terms?: string[];
- ignore?: unknown[];
- ignoreDatesOnPullRequests?: boolean;
- allowWarningComments?: boolean;
- date?: string;
- }
- ];
- /**
- * Enforce explicitly comparing the `length` or `size` property of a value.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/explicit-length-check.md
- */
- "eslint-plugin-unicorn/explicit-length-check"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- "non-zero"?: "greater-than" | "not-equal";
- }
- ];
- /**
- * Enforce a case style for filenames.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/filename-case.md
- */
- "eslint-plugin-unicorn/filename-case"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Enforce specific import styles per module.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/import-style.md
- */
- "eslint-plugin-unicorn/import-style"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce the use of `new` for all builtins, except `String`, `Number`, `Boolean`, `Symbol` and `BigInt`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/new-for-builtins.md
- */
- "eslint-plugin-unicorn/new-for-builtins"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce specifying rules to disable in `eslint-disable` comments.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-abusive-eslint-disable.md
- */
- "eslint-plugin-unicorn/no-abusive-eslint-disable"?: {
- [k: string]: unknown;
- };
- /**
- * Prevent passing a function reference directly to iterator methods.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-array-callback-reference.md
- */
- "eslint-plugin-unicorn/no-array-callback-reference"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `for…of` over the `forEach` method.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-array-for-each.md
- */
- "eslint-plugin-unicorn/no-array-for-each"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow using the `this` argument in array methods.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-array-method-this-argument.md
- */
- "eslint-plugin-unicorn/no-array-method-this-argument"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce combining multiple `Array#push()` into one call.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-array-push-push.md
- */
- "eslint-plugin-unicorn/no-array-push-push"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- ignore?: unknown[];
- }
- ];
- /**
- * Disallow `Array#reduce()` and `Array#reduceRight()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-array-reduce.md
- */
- "eslint-plugin-unicorn/no-array-reduce"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- allowSimpleOperations?: boolean;
- }
- ];
- /**
- * Disallow member access from await expression.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-await-expression-member.md
- */
- "eslint-plugin-unicorn/no-await-expression-member"?: {
- [k: string]: unknown;
- };
- /**
- * Do not use leading/trailing space between `console.log` parameters.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-console-spaces.md
- */
- "eslint-plugin-unicorn/no-console-spaces"?: {
- [k: string]: unknown;
- };
- /**
- * Do not use `document.cookie` directly.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-document-cookie.md
- */
- "eslint-plugin-unicorn/no-document-cookie"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow empty files.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-empty-file.md
- */
- "eslint-plugin-unicorn/no-empty-file"?: {
- [k: string]: unknown;
- };
- /**
- * Do not use a `for` loop that can be replaced with a `for-of` loop.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-for-loop.md
- */
- "eslint-plugin-unicorn/no-for-loop"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce the use of Unicode escapes instead of hexadecimal escapes.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-hex-escape.md
- */
- "eslint-plugin-unicorn/no-hex-escape"?: {
- [k: string]: unknown;
- };
- /**
- * Require `Array.isArray()` instead of `instanceof Array`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-instanceof-array.md
- */
- "eslint-plugin-unicorn/no-instanceof-array"?: {
- [k: string]: unknown;
- };
- /**
- * Prevent calling `EventTarget#removeEventListener()` with the result of an expression.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-invalid-remove-event-listener.md
- */
- "eslint-plugin-unicorn/no-invalid-remove-event-listener"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow identifiers starting with `new` or `class`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-keyword-prefix.md
- */
- "eslint-plugin-unicorn/no-keyword-prefix"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * @minItems 1
- * @maxItems 1
- */
- disallowedPrefixes?: [string];
- checkProperties?: boolean;
- onlyCamelCase?: boolean;
- }
- ];
- /**
- * Disallow `if` statements as the only statement in `if` blocks without `else`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-lonely-if.md
- */
- "eslint-plugin-unicorn/no-lonely-if"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow negated conditions.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-negated-condition.md
- */
- "eslint-plugin-unicorn/no-negated-condition"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow nested ternary expressions.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-nested-ternary.md
- */
- "eslint-plugin-unicorn/no-nested-ternary"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow `new Array()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-new-array.md
- */
- "eslint-plugin-unicorn/no-new-array"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-new-buffer.md
- */
- "eslint-plugin-unicorn/no-new-buffer"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow the use of the `null` literal.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-null.md
- */
- "eslint-plugin-unicorn/no-null"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- checkStrictEquality?: boolean;
- }
- ];
- /**
- * Disallow the use of objects as default parameters.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-object-as-default-parameter.md
- */
- "eslint-plugin-unicorn/no-object-as-default-parameter"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow `process.exit()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-process-exit.md
- */
- "eslint-plugin-unicorn/no-process-exit"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow classes that only have static members.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-static-only-class.md
- */
- "eslint-plugin-unicorn/no-static-only-class"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow `then` property.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-thenable.md
- */
- "eslint-plugin-unicorn/no-thenable"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow assigning `this` to a variable.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-this-assignment.md
- */
- "eslint-plugin-unicorn/no-this-assignment"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow comparing `undefined` using `typeof`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-typeof-undefined.md
- */
- "eslint-plugin-unicorn/no-typeof-undefined"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- checkGlobalVariables?: boolean;
- }
- ];
- /**
- * Disallow awaiting non-promise values.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-unnecessary-await.md
- */
- "eslint-plugin-unicorn/no-unnecessary-await"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow unreadable array destructuring.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-unreadable-array-destructuring.md
- */
- "eslint-plugin-unicorn/no-unreadable-array-destructuring"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow unreadable IIFEs.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-unreadable-iife.md
- */
- "eslint-plugin-unicorn/no-unreadable-iife"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow unused object properties.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-unused-properties.md
- */
- "eslint-plugin-unicorn/no-unused-properties"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow useless fallback when spreading in object literals.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-useless-fallback-in-spread.md
- */
- "eslint-plugin-unicorn/no-useless-fallback-in-spread"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow useless array length check.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-useless-length-check.md
- */
- "eslint-plugin-unicorn/no-useless-length-check"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-useless-promise-resolve-reject.md
- */
- "eslint-plugin-unicorn/no-useless-promise-resolve-reject"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow unnecessary spread.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-useless-spread.md
- */
- "eslint-plugin-unicorn/no-useless-spread"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow useless case in switch statements.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-useless-switch-case.md
- */
- "eslint-plugin-unicorn/no-useless-switch-case"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow useless `undefined`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-useless-undefined.md
- */
- "eslint-plugin-unicorn/no-useless-undefined"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- checkArguments?: boolean;
- }
- ];
- /**
- * Disallow number literals with zero fractions or dangling dots.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/no-zero-fractions.md
- */
- "eslint-plugin-unicorn/no-zero-fractions"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce proper case for numeric literals.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/number-literal-case.md
- */
- "eslint-plugin-unicorn/number-literal-case"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce the style of numeric separators by correctly grouping digits.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/numeric-separators-style.md
- */
- "eslint-plugin-unicorn/numeric-separators-style"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- binary?: {
- onlyIfContainsSeparator?: boolean;
- minimumDigits?: number;
- groupLength?: number;
- };
- octal?: {
- onlyIfContainsSeparator?: boolean;
- minimumDigits?: number;
- groupLength?: number;
- };
- hexadecimal?: {
- onlyIfContainsSeparator?: boolean;
- minimumDigits?: number;
- groupLength?: number;
- };
- number?: {
- onlyIfContainsSeparator?: boolean;
- minimumDigits?: number;
- groupLength?: number;
- };
- onlyIfContainsSeparator?: boolean;
- }
- ];
- /**
- * Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-add-event-listener.md
- */
- "eslint-plugin-unicorn/prefer-add-event-listener"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- excludedPackages?: string[];
- }
- ];
- /**
- * Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-array-find.md
- */
- "eslint-plugin-unicorn/prefer-array-find"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- checkFromLast?: boolean;
- }
- ];
- /**
- * Prefer `.flatMap(…)` over `.map(…).flat()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-array-flat-map.md
- */
- "eslint-plugin-unicorn/prefer-array-flat-map"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `Array#flat()` over legacy techniques to flatten arrays.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-array-flat.md
- */
- "eslint-plugin-unicorn/prefer-array-flat"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- functions?: unknown[];
- }
- ];
- /**
- * Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-array-index-of.md
- */
- "eslint-plugin-unicorn/prefer-array-index-of"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast}(…)`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-array-some.md
- */
- "eslint-plugin-unicorn/prefer-array-some"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `.at()` method for index access and `String#charAt()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-at.md
- */
- "eslint-plugin-unicorn/prefer-at"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- getLastElementFunctions?: unknown[];
- checkAllIndexAccess?: boolean;
- }
- ];
- /**
- * Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-blob-reading-methods.md
- */
- "eslint-plugin-unicorn/prefer-blob-reading-methods"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-code-point.md
- */
- "eslint-plugin-unicorn/prefer-code-point"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-date-now.md
- */
- "eslint-plugin-unicorn/prefer-date-now"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer default parameters over reassignment.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-default-parameters.md
- */
- "eslint-plugin-unicorn/prefer-default-parameters"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `Node#append()` over `Node#appendChild()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-dom-node-append.md
- */
- "eslint-plugin-unicorn/prefer-dom-node-append"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer using `.dataset` on DOM elements over calling attribute methods.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-dom-node-dataset.md
- */
- "eslint-plugin-unicorn/prefer-dom-node-dataset"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `childNode.remove()` over `parentNode.removeChild(childNode)`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-dom-node-remove.md
- */
- "eslint-plugin-unicorn/prefer-dom-node-remove"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `.textContent` over `.innerText`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-dom-node-text-content.md
- */
- "eslint-plugin-unicorn/prefer-dom-node-text-content"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `EventTarget` over `EventEmitter`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-event-target.md
- */
- "eslint-plugin-unicorn/prefer-event-target"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `export…from` when re-exporting.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-export-from.md
- */
- "eslint-plugin-unicorn/prefer-export-from"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- ignoreUsedVariables?: boolean;
- }
- ];
- /**
- * Prefer `.includes()` over `.indexOf()` and `Array#some()` when checking for existence or non-existence.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-includes.md
- */
- "eslint-plugin-unicorn/prefer-includes"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer reading a JSON file as a buffer.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-json-parse-buffer.md
- */
- "eslint-plugin-unicorn/prefer-json-parse-buffer"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-keyboard-event-key.md
- */
- "eslint-plugin-unicorn/prefer-keyboard-event-key"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer using a logical operator over a ternary.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-logical-operator-over-ternary.md
- */
- "eslint-plugin-unicorn/prefer-logical-operator-over-ternary"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce the use of `Math.trunc` instead of bitwise operators.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-math-trunc.md
- */
- "eslint-plugin-unicorn/prefer-math-trunc"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `.before()` over `.insertBefore()`, `.replaceWith()` over `.replaceChild()`, prefer one of `.before()`, `.after()`, `.append()` or `.prepend()` over `insertAdjacentText()` and `insertAdjacentElement()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-modern-dom-apis.md
- */
- "eslint-plugin-unicorn/prefer-modern-dom-apis"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer modern `Math` APIs over legacy patterns.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-modern-math-apis.md
- */
- "eslint-plugin-unicorn/prefer-modern-math-apis"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer JavaScript modules (ESM) over CommonJS.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-module.md
- */
- "eslint-plugin-unicorn/prefer-module"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-native-coercion-functions.md
- */
- "eslint-plugin-unicorn/prefer-native-coercion-functions"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer negative index over `.length - index` when possible.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-negative-index.md
- */
- "eslint-plugin-unicorn/prefer-negative-index"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer using the `node:` protocol when importing Node.js builtin modules.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-node-protocol.md
- */
- "eslint-plugin-unicorn/prefer-node-protocol"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `Number` static properties over global ones.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-number-properties.md
- */
- "eslint-plugin-unicorn/prefer-number-properties"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- checkInfinity?: boolean;
- }
- ];
- /**
- * Prefer using `Object.fromEntries(…)` to transform a list of key-value pairs into an object.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-object-from-entries.md
- */
- "eslint-plugin-unicorn/prefer-object-from-entries"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- functions?: unknown[];
- }
- ];
- /**
- * Prefer omitting the `catch` binding parameter.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-optional-catch-binding.md
- */
- "eslint-plugin-unicorn/prefer-optional-catch-binding"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer borrowing methods from the prototype instead of the instance.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-prototype-methods.md
- */
- "eslint-plugin-unicorn/prefer-prototype-methods"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `.querySelector()` over `.getElementById()`, `.querySelectorAll()` over `.getElementsByClassName()` and `.getElementsByTagName()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-query-selector.md
- */
- "eslint-plugin-unicorn/prefer-query-selector"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `Reflect.apply()` over `Function#apply()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-reflect-apply.md
- */
- "eslint-plugin-unicorn/prefer-reflect-apply"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-regexp-test.md
- */
- "eslint-plugin-unicorn/prefer-regexp-test"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-set-has.md
- */
- "eslint-plugin-unicorn/prefer-set-has"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer using `Set#size` instead of `Array#length`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-set-size.md
- */
- "eslint-plugin-unicorn/prefer-set-size"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer the spread operator over `Array.from(…)`, `Array#concat(…)`, `Array#{slice,toSpliced}()` and `String#split('')`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-spread.md
- */
- "eslint-plugin-unicorn/prefer-spread"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `String#replaceAll()` over regex searches with the global flag.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-string-replace-all.md
- */
- "eslint-plugin-unicorn/prefer-string-replace-all"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `String#slice()` over `String#substr()` and `String#substring()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-string-slice.md
- */
- "eslint-plugin-unicorn/prefer-string-slice"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `String#startsWith()` & `String#endsWith()` over `RegExp#test()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-string-starts-ends-with.md
- */
- "eslint-plugin-unicorn/prefer-string-starts-ends-with"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-string-trim-start-end.md
- */
- "eslint-plugin-unicorn/prefer-string-trim-start-end"?: {
- [k: string]: unknown;
- };
- /**
- * Prefer `switch` over multiple `else-if`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-switch.md
- */
- "eslint-plugin-unicorn/prefer-switch"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- minimumCases?: number;
- emptyDefaultCase?: "no-default-comment" | "do-nothing-comment" | "no-default-case";
- }
- ];
- /**
- * Prefer ternary expressions over simple `if-else` statements.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-ternary.md
- */
- "eslint-plugin-unicorn/prefer-ternary"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Prefer top-level await over top-level promises and async function calls.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-top-level-await.md
- */
- "eslint-plugin-unicorn/prefer-top-level-await"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce throwing `TypeError` in type checking conditions.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prefer-type-error.md
- */
- "eslint-plugin-unicorn/prefer-type-error"?: {
- [k: string]: unknown;
- };
- /**
- * Prevent abbreviations.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/prevent-abbreviations.md
- */
- "eslint-plugin-unicorn/prevent-abbreviations"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce consistent relative URL style.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/relative-url-style.md
- */
- "eslint-plugin-unicorn/relative-url-style"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Enforce using the separator argument with `Array#join()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/require-array-join-separator.md
- */
- "eslint-plugin-unicorn/require-array-join-separator"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce using the digits argument with `Number#toFixed()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/require-number-to-fixed-digits-argument.md
- */
- "eslint-plugin-unicorn/require-number-to-fixed-digits-argument"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce using the `targetOrigin` argument with `window.postMessage()`.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/require-post-message-target-origin.md
- */
- "eslint-plugin-unicorn/require-post-message-target-origin"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce better string content.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/string-content.md
- */
- "eslint-plugin-unicorn/string-content"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- patterns?: {
- [k: string]:
- | string
- | {
- suggest: string;
- fix?: boolean;
- message?: string;
- };
- };
- }
- ];
- /**
- * Enforce consistent brace style for `case` clauses.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/switch-case-braces.md
- */
- "eslint-plugin-unicorn/switch-case-braces"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Fix whitespace-insensitive template indentation.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/template-indent.md
- */
- "eslint-plugin-unicorn/template-indent"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- indent?: string | number;
- tags?: string[];
- functions?: string[];
- selectors?: string[];
- comments?: string[];
- }
- ];
- /**
- * Enforce consistent case for text encoding identifiers.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/text-encoding-identifier-case.md
- */
- "eslint-plugin-unicorn/text-encoding-identifier-case"?: {
- [k: string]: unknown;
- };
- /**
- * Require `new` when throwing an error.
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/rules/throw-new-error.md
- */
- "eslint-plugin-unicorn/throw-new-error"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#import-index
- */
- "eslint-plugin-unicorn/import-index"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#no-array-instanceof
- */
- "eslint-plugin-unicorn/no-array-instanceof"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#no-fn-reference-in-iterator
- */
- "eslint-plugin-unicorn/no-fn-reference-in-iterator"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#no-reduce
- */
- "eslint-plugin-unicorn/no-reduce"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#no-unsafe-regex
- */
- "eslint-plugin-unicorn/no-unsafe-regex"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-dataset
- */
- "eslint-plugin-unicorn/prefer-dataset"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-event-key
- */
- "eslint-plugin-unicorn/prefer-event-key"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-exponentiation-operator
- */
- "eslint-plugin-unicorn/prefer-exponentiation-operator"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-flat-map
- */
- "eslint-plugin-unicorn/prefer-flat-map"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-node-append
- */
- "eslint-plugin-unicorn/prefer-node-append"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-node-remove
- */
- "eslint-plugin-unicorn/prefer-node-remove"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-object-has-own
- */
- "eslint-plugin-unicorn/prefer-object-has-own"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-replace-all
- */
- "eslint-plugin-unicorn/prefer-replace-all"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-starts-ends-with
- */
- "eslint-plugin-unicorn/prefer-starts-ends-with"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-text-content
- */
- "eslint-plugin-unicorn/prefer-text-content"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#prefer-trim-start-end
- */
- "eslint-plugin-unicorn/prefer-trim-start-end"?: {
- [k: string]: unknown;
- };
- /**
- *
- * https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v49.0.0/docs/deprecated-rules.md#regex-shorthand
- */
- "eslint-plugin-unicorn/regex-shorthand"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce linebreaks after opening and before closing array brackets in ``
- * https://eslint.vuejs.org/rules/array-bracket-newline.html
- */
- "eslint-plugin-vue/array-bracket-newline"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Enforce consistent spacing inside array brackets in ``
- * https://eslint.vuejs.org/rules/array-bracket-spacing.html
- */
- "eslint-plugin-vue/array-bracket-spacing"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Enforce line breaks after each array element in ``
- * https://eslint.vuejs.org/rules/array-element-newline.html
- */
- "eslint-plugin-vue/array-element-newline"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce consistent spacing before and after the arrow in arrow functions in ``
- * https://eslint.vuejs.org/rules/arrow-spacing.html
- */
- "eslint-plugin-vue/arrow-spacing"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- before?: boolean;
- after?: boolean;
- }
- ];
- /**
- * enforce attribute naming style on custom components in template
- * https://eslint.vuejs.org/rules/attribute-hyphenation.html
- */
- "eslint-plugin-vue/attribute-hyphenation"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce order of attributes
- * https://eslint.vuejs.org/rules/attributes-order.html
- */
- "eslint-plugin-vue/attributes-order"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- order?: (
- | (
- | "DEFINITION"
- | "LIST_RENDERING"
- | "CONDITIONALS"
- | "RENDER_MODIFIERS"
- | "GLOBAL"
- | "UNIQUE"
- | "SLOT"
- | "TWO_WAY_BINDING"
- | "OTHER_DIRECTIVES"
- | "OTHER_ATTR"
- | "ATTR_STATIC"
- | "ATTR_DYNAMIC"
- | "ATTR_SHORTHAND_BOOL"
- | "EVENTS"
- | "CONTENT"
- )
- | (
- | "DEFINITION"
- | "LIST_RENDERING"
- | "CONDITIONALS"
- | "RENDER_MODIFIERS"
- | "GLOBAL"
- | "UNIQUE"
- | "SLOT"
- | "TWO_WAY_BINDING"
- | "OTHER_DIRECTIVES"
- | "OTHER_ATTR"
- | "ATTR_STATIC"
- | "ATTR_DYNAMIC"
- | "ATTR_SHORTHAND_BOOL"
- | "EVENTS"
- | "CONTENT"
- )[]
- )[];
- alphabetical?: boolean;
- }
- ];
- /**
- * disallow use other than available `lang`
- * https://eslint.vuejs.org/rules/block-lang.html
- */
- "eslint-plugin-vue/block-lang"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce order of component top-level elements
- * https://eslint.vuejs.org/rules/block-order.html
- */
- "eslint-plugin-vue/block-order"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- order?: (string | string[])[];
- }
- ];
- /**
- * Disallow or enforce spaces inside of blocks after opening block and before closing block in ``
- * https://eslint.vuejs.org/rules/block-spacing.html
- */
- "eslint-plugin-vue/block-spacing"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce line breaks after opening and before closing block-level tags
- * https://eslint.vuejs.org/rules/block-tag-newline.html
- */
- "eslint-plugin-vue/block-tag-newline"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- singleline?: "always" | "never" | "consistent" | "ignore";
- multiline?: "always" | "never" | "consistent" | "ignore";
- maxEmptyLines?: number;
- blocks?: {
- /**
- * This interface was referenced by `undefined`'s JSON-Schema definition
- * via the `patternProperty` "^(?:\S+)$".
- */
- [k: string]: {
- singleline?: "always" | "never" | "consistent" | "ignore";
- multiline?: "always" | "never" | "consistent" | "ignore";
- maxEmptyLines?: number;
- };
- };
- }
- ];
- /**
- * Enforce consistent brace style for blocks in ``
- * https://eslint.vuejs.org/rules/brace-style.html
- */
- "eslint-plugin-vue/brace-style"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * Enforce camelcase naming convention in ``
- * https://eslint.vuejs.org/rules/camelcase.html
- */
- "eslint-plugin-vue/camelcase"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- ignoreDestructuring?: boolean;
- ignoreImports?: boolean;
- ignoreGlobals?: boolean;
- properties?: "always" | "never";
- /**
- * @minItems 0
- */
- allow?: [] | [string];
- }
- ];
- /**
- * Require or disallow trailing commas in ``
- * https://eslint.vuejs.org/rules/comma-dangle.html
- */
- "eslint-plugin-vue/comma-dangle"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce consistent spacing before and after commas in ``
- * https://eslint.vuejs.org/rules/comma-spacing.html
- */
- "eslint-plugin-vue/comma-spacing"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- before?: boolean;
- after?: boolean;
- }
- ];
- /**
- * Enforce consistent comma style in ``
- * https://eslint.vuejs.org/rules/comma-style.html
- */
- "eslint-plugin-vue/comma-style"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * support comment-directives in ``
- * https://eslint.vuejs.org/rules/comment-directive.html
- */
- "eslint-plugin-vue/comment-directive"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- reportUnusedDisableDirectives?: boolean;
- }
- ];
- /**
- * enforce component API style
- * https://eslint.vuejs.org/rules/component-api-style.html
- */
- "eslint-plugin-vue/component-api-style"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce specific casing for component definition name
- * https://eslint.vuejs.org/rules/component-definition-name-casing.html
- */
- "eslint-plugin-vue/component-definition-name-casing"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce specific casing for the component naming style in template
- * https://eslint.vuejs.org/rules/component-name-in-template-casing.html
- */
- "eslint-plugin-vue/component-name-in-template-casing"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce the casing of component name in `components` options
- * https://eslint.vuejs.org/rules/component-options-name-casing.html
- */
- "eslint-plugin-vue/component-options-name-casing"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce order of component top-level elements
- * https://eslint.vuejs.org/rules/component-tags-order.html
- */
- "eslint-plugin-vue/component-tags-order"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- order?: (string | string[])[];
- }
- ];
- /**
- * enforce specific casing for custom event name
- * https://eslint.vuejs.org/rules/custom-event-name-casing.html
- */
- "eslint-plugin-vue/custom-event-name-casing"?: {
- [k: string]: unknown;
- };
- /**
- * enforce declaration style of `defineEmits`
- * https://eslint.vuejs.org/rules/define-emits-declaration.html
- */
- "eslint-plugin-vue/define-emits-declaration"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce order of `defineEmits` and `defineProps` compiler macros
- * https://eslint.vuejs.org/rules/define-macros-order.html
- */
- "eslint-plugin-vue/define-macros-order"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- order?: ("defineEmits" | "defineProps" | "defineOptions" | "defineSlots")[];
- }
- ];
- /**
- * enforce declaration style of `defineProps`
- * https://eslint.vuejs.org/rules/define-props-declaration.html
- */
- "eslint-plugin-vue/define-props-declaration"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * Enforce consistent newlines before and after dots in ``
- * https://eslint.vuejs.org/rules/dot-location.html
- */
- "eslint-plugin-vue/dot-location"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * Enforce dot notation whenever possible in ``
- * https://eslint.vuejs.org/rules/dot-notation.html
- */
- "eslint-plugin-vue/dot-notation"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- allowKeywords?: boolean;
- allowPattern?: string;
- }
- ];
- /**
- * Require the use of `===` and `!==` in ``
- * https://eslint.vuejs.org/rules/eqeqeq.html
- */
- "eslint-plugin-vue/eqeqeq"?: {
- [k: string]: unknown;
- };
- /**
- * enforce the location of first attribute
- * https://eslint.vuejs.org/rules/first-attribute-linebreak.html
- */
- "eslint-plugin-vue/first-attribute-linebreak"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- multiline?: "below" | "beside" | "ignore";
- singleline?: "below" | "beside" | "ignore";
- }
- ];
- /**
- * Require or disallow spacing between function identifiers and their invocations in ``
- * https://eslint.vuejs.org/rules/func-call-spacing.html
- */
- "eslint-plugin-vue/func-call-spacing"?: {
- [k: string]: unknown;
- };
- /**
- * disallow usage of button without an explicit type attribute
- * https://eslint.vuejs.org/rules/html-button-has-type.html
- */
- "eslint-plugin-vue/html-button-has-type"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- button?: boolean;
- submit?: boolean;
- reset?: boolean;
- }
- ];
- /**
- * require or disallow a line break before tag's closing brackets
- * https://eslint.vuejs.org/rules/html-closing-bracket-newline.html
- */
- "eslint-plugin-vue/html-closing-bracket-newline"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- singleline?: "always" | "never";
- multiline?: "always" | "never";
- }
- ];
- /**
- * require or disallow a space before tag's closing brackets
- * https://eslint.vuejs.org/rules/html-closing-bracket-spacing.html
- */
- "eslint-plugin-vue/html-closing-bracket-spacing"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- startTag?: "always" | "never";
- endTag?: "always" | "never";
- selfClosingTag?: "always" | "never";
- }
- ];
- /**
- * enforce unified line brake in HTML comments
- * https://eslint.vuejs.org/rules/html-comment-content-newline.html
- */
- "eslint-plugin-vue/html-comment-content-newline"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce unified spacing in HTML comments
- * https://eslint.vuejs.org/rules/html-comment-content-spacing.html
- */
- "eslint-plugin-vue/html-comment-content-spacing"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce consistent indentation in HTML comments
- * https://eslint.vuejs.org/rules/html-comment-indent.html
- */
- "eslint-plugin-vue/html-comment-indent"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce end tag style
- * https://eslint.vuejs.org/rules/html-end-tags.html
- */
- "eslint-plugin-vue/html-end-tags"?: {
- [k: string]: unknown;
- };
- /**
- * enforce consistent indentation in ``
- * https://eslint.vuejs.org/rules/html-indent.html
- */
- "eslint-plugin-vue/html-indent"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce quotes style of HTML attributes
- * https://eslint.vuejs.org/rules/html-quotes.html
- */
- "eslint-plugin-vue/html-quotes"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce self-closing style
- * https://eslint.vuejs.org/rules/html-self-closing.html
- */
- "eslint-plugin-vue/html-self-closing"?: {
- [k: string]: unknown;
- };
- /**
- * prevent variables used in JSX to be marked as unused
- * https://eslint.vuejs.org/rules/jsx-uses-vars.html
- */
- "eslint-plugin-vue/jsx-uses-vars"?: {
- [k: string]: unknown;
- };
- /**
- * Enforce consistent spacing between keys and values in object literal properties in ``
- * https://eslint.vuejs.org/rules/key-spacing.html
- */
- "eslint-plugin-vue/key-spacing"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * Enforce consistent spacing before and after keywords in ``
- * https://eslint.vuejs.org/rules/keyword-spacing.html
- */
- "eslint-plugin-vue/keyword-spacing"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- before?: boolean;
- after?: boolean;
- overrides?: {
- abstract?: {
- before?: boolean;
- after?: boolean;
- };
- as?: {
- before?: boolean;
- after?: boolean;
- };
- async?: {
- before?: boolean;
- after?: boolean;
- };
- await?: {
- before?: boolean;
- after?: boolean;
- };
- boolean?: {
- before?: boolean;
- after?: boolean;
- };
- break?: {
- before?: boolean;
- after?: boolean;
- };
- byte?: {
- before?: boolean;
- after?: boolean;
- };
- case?: {
- before?: boolean;
- after?: boolean;
- };
- catch?: {
- before?: boolean;
- after?: boolean;
- };
- char?: {
- before?: boolean;
- after?: boolean;
- };
- class?: {
- before?: boolean;
- after?: boolean;
- };
- const?: {
- before?: boolean;
- after?: boolean;
- };
- continue?: {
- before?: boolean;
- after?: boolean;
- };
- debugger?: {
- before?: boolean;
- after?: boolean;
- };
- default?: {
- before?: boolean;
- after?: boolean;
- };
- delete?: {
- before?: boolean;
- after?: boolean;
- };
- do?: {
- before?: boolean;
- after?: boolean;
- };
- double?: {
- before?: boolean;
- after?: boolean;
- };
- else?: {
- before?: boolean;
- after?: boolean;
- };
- enum?: {
- before?: boolean;
- after?: boolean;
- };
- export?: {
- before?: boolean;
- after?: boolean;
- };
- extends?: {
- before?: boolean;
- after?: boolean;
- };
- false?: {
- before?: boolean;
- after?: boolean;
- };
- final?: {
- before?: boolean;
- after?: boolean;
- };
- finally?: {
- before?: boolean;
- after?: boolean;
- };
- float?: {
- before?: boolean;
- after?: boolean;
- };
- for?: {
- before?: boolean;
- after?: boolean;
- };
- from?: {
- before?: boolean;
- after?: boolean;
- };
- function?: {
- before?: boolean;
- after?: boolean;
- };
- get?: {
- before?: boolean;
- after?: boolean;
- };
- goto?: {
- before?: boolean;
- after?: boolean;
- };
- if?: {
- before?: boolean;
- after?: boolean;
- };
- implements?: {
- before?: boolean;
- after?: boolean;
- };
- import?: {
- before?: boolean;
- after?: boolean;
- };
- in?: {
- before?: boolean;
- after?: boolean;
- };
- instanceof?: {
- before?: boolean;
- after?: boolean;
- };
- int?: {
- before?: boolean;
- after?: boolean;
- };
- interface?: {
- before?: boolean;
- after?: boolean;
- };
- let?: {
- before?: boolean;
- after?: boolean;
- };
- long?: {
- before?: boolean;
- after?: boolean;
- };
- native?: {
- before?: boolean;
- after?: boolean;
- };
- new?: {
- before?: boolean;
- after?: boolean;
- };
- null?: {
- before?: boolean;
- after?: boolean;
- };
- of?: {
- before?: boolean;
- after?: boolean;
- };
- package?: {
- before?: boolean;
- after?: boolean;
- };
- private?: {
- before?: boolean;
- after?: boolean;
- };
- protected?: {
- before?: boolean;
- after?: boolean;
- };
- public?: {
- before?: boolean;
- after?: boolean;
- };
- return?: {
- before?: boolean;
- after?: boolean;
- };
- set?: {
- before?: boolean;
- after?: boolean;
- };
- short?: {
- before?: boolean;
- after?: boolean;
- };
- static?: {
- before?: boolean;
- after?: boolean;
- };
- super?: {
- before?: boolean;
- after?: boolean;
- };
- switch?: {
- before?: boolean;
- after?: boolean;
- };
- synchronized?: {
- before?: boolean;
- after?: boolean;
- };
- this?: {
- before?: boolean;
- after?: boolean;
- };
- throw?: {
- before?: boolean;
- after?: boolean;
- };
- throws?: {
- before?: boolean;
- after?: boolean;
- };
- transient?: {
- before?: boolean;
- after?: boolean;
- };
- true?: {
- before?: boolean;
- after?: boolean;
- };
- try?: {
- before?: boolean;
- after?: boolean;
- };
- typeof?: {
- before?: boolean;
- after?: boolean;
- };
- var?: {
- before?: boolean;
- after?: boolean;
- };
- void?: {
- before?: boolean;
- after?: boolean;
- };
- volatile?: {
- before?: boolean;
- after?: boolean;
- };
- while?: {
- before?: boolean;
- after?: boolean;
- };
- with?: {
- before?: boolean;
- after?: boolean;
- };
- yield?: {
- before?: boolean;
- after?: boolean;
- };
- };
- }
- ];
- /**
- * require component name property to match its file name
- * https://eslint.vuejs.org/rules/match-component-file-name.html
- */
- "eslint-plugin-vue/match-component-file-name"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- extensions?: string[];
- shouldMatchCase?: boolean;
- }
- ];
- /**
- * require the registered component name to match the imported component name
- * https://eslint.vuejs.org/rules/match-component-import-name.html
- */
- "eslint-plugin-vue/match-component-import-name"?: {
- [k: string]: unknown;
- };
- /**
- * enforce the maximum number of attributes per line
- * https://eslint.vuejs.org/rules/max-attributes-per-line.html
- */
- "eslint-plugin-vue/max-attributes-per-line"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- singleline?:
- | number
- | {
- max?: number;
- };
- multiline?:
- | number
- | {
- max?: number;
- };
- }
- ];
- /**
- * enforce a maximum line length in `.vue` files
- * https://eslint.vuejs.org/rules/max-len.html
- */
- "eslint-plugin-vue/max-len"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce maximum number of lines in Vue SFC blocks
- * https://eslint.vuejs.org/rules/max-lines-per-block.html
- */
- "eslint-plugin-vue/max-lines-per-block"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- style?: number;
- template?: number;
- script?: number;
- skipBlankLines?: boolean;
- }
- ];
- /**
- * require component names to be always multi-word
- * https://eslint.vuejs.org/rules/multi-word-component-names.html
- */
- "eslint-plugin-vue/multi-word-component-names"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- ignores?: string[];
- }
- ];
- /**
- * require a line break before and after the contents of a multiline element
- * https://eslint.vuejs.org/rules/multiline-html-element-content-newline.html
- */
- "eslint-plugin-vue/multiline-html-element-content-newline"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- ignoreWhenEmpty?: boolean;
- ignores?: string[];
- allowEmptyLines?: boolean;
- }
- ];
- /**
- * Enforce newlines between operands of ternary expressions in ``
- * https://eslint.vuejs.org/rules/multiline-ternary.html
- */
- "eslint-plugin-vue/multiline-ternary"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce unified spacing in mustache interpolations
- * https://eslint.vuejs.org/rules/mustache-interpolation-spacing.html
- */
- "eslint-plugin-vue/mustache-interpolation-spacing"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * enforce new lines between multi-line properties in Vue components
- * https://eslint.vuejs.org/rules/new-line-between-multi-line-property.html
- */
- "eslint-plugin-vue/new-line-between-multi-line-property"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- minLineOfMultilineProperty?: number;
- }
- ];
- /**
- * enforce Promise or callback style in `nextTick`
- * https://eslint.vuejs.org/rules/next-tick-style.html
- */
- "eslint-plugin-vue/next-tick-style"?: number | ("off" | "warn" | "error") | [number | ("off" | "warn" | "error"), {}];
- /**
- * disallow using arrow functions to define watcher
- * https://eslint.vuejs.org/rules/no-arrow-functions-in-watch.html
- */
- "eslint-plugin-vue/no-arrow-functions-in-watch"?: {
- [k: string]: unknown;
- };
- /**
- * disallow asynchronous actions in computed properties
- * https://eslint.vuejs.org/rules/no-async-in-computed-properties.html
- */
- "eslint-plugin-vue/no-async-in-computed-properties"?: {
- [k: string]: unknown;
- };
- /**
- * disallow the use of bare strings in ``
- * https://eslint.vuejs.org/rules/no-bare-strings-in-template.html
- */
- "eslint-plugin-vue/no-bare-strings-in-template"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- allowlist?: string[];
- attributes?: {
- /**
- * This interface was referenced by `undefined`'s JSON-Schema definition
- * via the `patternProperty` "^(?:\S+|/.*\/[a-z]*)$".
- */
- [k: string]: string[];
- };
- directives?: string[];
- }
- ];
- /**
- * disallow boolean defaults
- * https://eslint.vuejs.org/rules/no-boolean-default.html
- */
- "eslint-plugin-vue/no-boolean-default"?:
- | number
- | ("off" | "warn" | "error")
- | [number | ("off" | "warn" | "error"), {}];
- /**
- * disallow element's child contents which would be overwritten by a directive like `v-html` or `v-text`
- * https://eslint.vuejs.org/rules/no-child-content.html
- */
- "eslint-plugin-vue/no-child-content"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * @minItems 1
- */
- additionalDirectives?: [string, ...string[]];
- }
- ];
- /**
- * disallow accessing computed properties in `data`.
- * https://eslint.vuejs.org/rules/no-computed-properties-in-data.html
- */
- "eslint-plugin-vue/no-computed-properties-in-data"?: {
- [k: string]: unknown;
- };
- /**
- * Disallow the use of `console` in ``
- * https://eslint.vuejs.org/rules/no-console.html
- */
- "eslint-plugin-vue/no-console"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * @minItems 1
- */
- allow?: [string, ...string[]];
- }
- ];
- /**
- * Disallow constant expressions in conditions in ``
- * https://eslint.vuejs.org/rules/no-constant-condition.html
- */
- "eslint-plugin-vue/no-constant-condition"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- checkLoops?: boolean;
- }
- ];
- /**
- * disallow custom modifiers on v-model used on the component
- * https://eslint.vuejs.org/rules/no-custom-modifiers-on-v-model.html
- */
- "eslint-plugin-vue/no-custom-modifiers-on-v-model"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated object declaration on data (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-data-object-declaration.html
- */
- "eslint-plugin-vue/no-deprecated-data-object-declaration"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated `destroyed` and `beforeDestroy` lifecycle hooks (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-destroyed-lifecycle.html
- */
- "eslint-plugin-vue/no-deprecated-destroyed-lifecycle"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated `$listeners` (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-dollar-listeners-api.html
- */
- "eslint-plugin-vue/no-deprecated-dollar-listeners-api"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated `$scopedSlots` (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-dollar-scopedslots-api.html
- */
- "eslint-plugin-vue/no-deprecated-dollar-scopedslots-api"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated events api (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-events-api.html
- */
- "eslint-plugin-vue/no-deprecated-events-api"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated filters syntax (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-filter.html
- */
- "eslint-plugin-vue/no-deprecated-filter"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated the `functional` template (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-functional-template.html
- */
- "eslint-plugin-vue/no-deprecated-functional-template"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated the `is` attribute on HTML elements (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-html-element-is.html
- */
- "eslint-plugin-vue/no-deprecated-html-element-is"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated `inline-template` attribute (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-inline-template.html
- */
- "eslint-plugin-vue/no-deprecated-inline-template"?: {
- [k: string]: unknown;
- };
- /**
- * disallow deprecated `model` definition (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-model-definition.html
- */
- "eslint-plugin-vue/no-deprecated-model-definition"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- allowVue3Compat?: boolean;
- }
- ];
- /**
- * disallow deprecated `this` access in props default function (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-props-default-this.html
- */
- "eslint-plugin-vue/no-deprecated-props-default-this"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated `tag` property on `RouterLink` (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-router-link-tag-prop.html
- */
- "eslint-plugin-vue/no-deprecated-router-link-tag-prop"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- /**
- * @minItems 1
- */
- components?: [string, ...string[]];
- }
- ];
- /**
- * disallow deprecated `scope` attribute (in Vue.js 2.5.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-scope-attribute.html
- */
- "eslint-plugin-vue/no-deprecated-scope-attribute"?: {
- [k: string]: unknown;
- };
- /**
- * disallow deprecated `slot` attribute (in Vue.js 2.6.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html
- */
- "eslint-plugin-vue/no-deprecated-slot-attribute"?: {
- [k: string]: unknown;
- };
- /**
- * disallow deprecated `slot-scope` attribute (in Vue.js 2.6.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-slot-scope-attribute.html
- */
- "eslint-plugin-vue/no-deprecated-slot-scope-attribute"?: {
- [k: string]: unknown;
- };
- /**
- * disallow use of deprecated `.sync` modifier on `v-bind` directive (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-v-bind-sync.html
- */
- "eslint-plugin-vue/no-deprecated-v-bind-sync"?: {
- [k: string]: unknown;
- };
- /**
- * disallow deprecated `v-is` directive (in Vue.js 3.1.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-v-is.html
- */
- "eslint-plugin-vue/no-deprecated-v-is"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated `.native` modifiers (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-v-on-native-modifier.html
- */
- "eslint-plugin-vue/no-deprecated-v-on-native-modifier"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated number (keycode) modifiers (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-v-on-number-modifiers.html
- */
- "eslint-plugin-vue/no-deprecated-v-on-number-modifiers"?: {
- [k: string]: unknown;
- };
- /**
- * disallow using deprecated `Vue.config.keyCodes` (in Vue.js 3.0.0+)
- * https://eslint.vuejs.org/rules/no-deprecated-vue-config-keycodes.html
- */
- "eslint-plugin-vue/no-deprecated-vue-config-keycodes"?: {
- [k: string]: unknown;
- };
- /**
- * disallow duplication of field names
- * https://eslint.vuejs.org/rules/no-dupe-keys.html
- */
- "eslint-plugin-vue/no-dupe-keys"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- groups?: unknown[];
- }
- ];
- /**
- * disallow duplicate conditions in `v-if` / `v-else-if` chains
- * https://eslint.vuejs.org/rules/no-dupe-v-else-if.html
- */
- "eslint-plugin-vue/no-dupe-v-else-if"?: {
- [k: string]: unknown;
- };
- /**
- * enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"`
- * https://eslint.vuejs.org/rules/no-duplicate-attr-inheritance.html
- */
- "eslint-plugin-vue/no-duplicate-attr-inheritance"?: {
- [k: string]: unknown;
- };
- /**
- * disallow duplication of attributes
- * https://eslint.vuejs.org/rules/no-duplicate-attributes.html
- */
- "eslint-plugin-vue/no-duplicate-attributes"?:
- | number
- | ("off" | "warn" | "error")
- | [
- number | ("off" | "warn" | "error"),
- {
- allowCoexistClass?: boolean;
- allowCoexistStyle?: boolean;
- }
- ];
- /**
- * disallow the `` ` |