## Description Removing unused dependencies and explicitly installing used ones. The identification of dependencies was done using the [knip](https://knip.dev/). Dependency lists are provided in the appropriate files. - [Unused dependencies.txt](https://github.com/user-attachments/files/17161963/Unused.dependencies.txt) - [Unused devDependencies.txt](https://github.com/user-attachments/files/17161964/Unused.devDependencies.txt) - [Unlisted dependencies.txt](https://github.com/user-attachments/files/17161965/Unlisted.dependencies.txt) EE PR — https://github.com/appsmithorg/appsmith-ee/pull/5229 ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11100669672> > Commit: 31b8da3dd07e452c8921526cd8e1336b11add27f > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11100669672&attempt=3" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Mon, 30 Sep 2024 09:15:27 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes - **New Features** - Introduced new dependencies to enhance functionality and observability. - **Bug Fixes** - Removed outdated or unnecessary dependencies to streamline the application. - **Documentation** - Updated configuration files to improve clarity and maintainability. - **Chores** - Cleaned up various package files by removing unused dependencies across multiple modules. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|---|---|---|
| .. | ||
| src | ||
| .eslintrc.json | ||
| .prettierignore | ||
| jest.config.js | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Adding a Custom Rule to Your Appsmith ESLint Plugin
Welcome to the guide for adding a custom rule to your Appsmith ESLint plugin. Follow these steps to create and integrate a new rule into your Appsmith ESLint plugin.
You can create one by following the official ESLint custom rule.
Step 1: Create the Custom Rule File
-
Navigate to your Appsmith ESLint plugin directory i.e.
app/client/packages/eslint-plugin. -
Create a new directory for your custom rule in the root of
app/client/packages/eslint-plugindirectory. For example,src/custom-rule/rule.ts.mkdir src/custom-rule touch src/custom-rule/rule.ts touch src/custom-rule/rule.test.ts -
Open
src/custom-rule/rule.tsand define your rule. Here's a basic template to get you started:import type { TSESLint } from "@typescript-eslint/utils"; export const customRule: TSESLint.RuleModule<"useObjectKeys"> = { defaultOptions: [], meta: { type: "problem", // or "suggestion" or "layout" docs: { description: "A description of what the rule does", category: "Best Practices", recommended: false, }, fixable: null, // or "code" if the rule can fix issues automatically schema: [], // JSON Schema for rule options }, create(context) { return { // Define the rule's behavior here // e.g., "Identifier": (node) => { /* logic */ } }; }, };
Step 2: Update the Plugin Index File
-
Open the
src/index.tsfile insideeslint-plugindirectory. -
Import your custom rule and add it to the rules object in
index.ts. For example:import { customRule } from "./custom-rule/rule"; const plugin = { rules: { "custom-rule": customRule, }, configs: { recommended: { rules: { "@appsmith/custom-rule": "warn", // Add this in recommended if you want to add this rule by default to the repository as a recommended rule. }, }, }, }; module.exports = plugin;
Step 3: Add Tests for Your Custom Rule
-
Open
src/custom-rule/rule.test.tsand write tests using a testing framework like Jest. Here's a basic example using ESLint'sRuleTester:import { TSESLint } from "@typescript-eslint/utils"; import { customRule } from "./rule"; const ruleTester = new TSESLint.RuleTester(); ruleTester.run("custom-rule", customRule, { valid: [ // Examples of valid code ], invalid: [ { code: "const foo = 1;", errors: [{ message: "Your custom error message" }], }, ], }); -
Run your tests to ensure your rule works as expected:
yarn run test:unit
Step 4: Steps to add it to client
-
Go to
app/client/.eslintrc.base.json -
Add your
custom-ruleentry to the rules object or if the recommended rule is present its already added in the config. e.g."@appsmith/custom-rule": "warn"
Additional Resources
Happy linting!