{"id":15105,"library":"eslint-config-salesforce-typescript","title":"Salesforce ESLint Configuration for TypeScript","description":"eslint-config-salesforce-typescript is a comprehensive ESLint configuration designed specifically for TypeScript projects within the Salesforce ecosystem. Currently at version 4.0.1, this package provides a curated set of ESLint rules, including those from `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser`, ensuring consistent code quality and adherence to Salesforce's coding standards for TypeScript. It offers a structured approach to linting, integrating best practices for TypeScript development, and helps prevent common issues. The package receives regular maintenance updates, often weekly or bi-weekly as evidenced by the release log, primarily focused on dependency bumps and minor rule adjustments. It differentiates itself by providing a ready-to-use setup tailored for Salesforce projects, abstracting away the complexity of configuring multiple ESLint plugins for TypeScript. Developers can extend this configuration in their `.eslintrc` files, simplifying the setup process for new and existing projects.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/forcedotcom/eslint-config-salesforce-typescript","tags":["javascript","Salesforce","eslint","typescript"],"install":[{"cmd":"npm install eslint-config-salesforce-typescript","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-config-salesforce-typescript","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-config-salesforce-typescript","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core ESLint engine, required to run linting.","package":"eslint","optional":false},{"reason":"ESLint plugin for import/export syntax, part of the core configuration.","package":"eslint-plugin-import","optional":false},{"reason":"Integrates Prettier formatting into ESLint rules.","package":"eslint-plugin-prettier","optional":false},{"reason":"Enforces JSDoc comment conventions.","package":"eslint-plugin-jsdoc","optional":false},{"reason":"TypeScript specific ESLint rules.","package":"@typescript-eslint/eslint-plugin","optional":false},{"reason":"Parser for TypeScript files, allowing ESLint to understand TypeScript syntax.","package":"@typescript-eslint/parser","optional":false},{"reason":"Optional: For Salesforce-owned repositories, extends license checking rules.","package":"eslint-config-salesforce-license","optional":true}],"imports":[{"note":"ESLint configurations are applied via the 'extends' property in an .eslintrc file, not imported as modules in source code.","wrong":"import { config } from 'eslint-config-salesforce-typescript';","symbol":"ESLint Configuration Extension","correct":"module.exports = { extends: ['eslint-config-salesforce-typescript'] };"},{"note":"To modify or disable specific rules, add a 'rules' section to your .eslintrc file after extending the base configuration. Your custom rules will override the defaults.","symbol":"ESLint Rule Override","correct":"module.exports = { extends: ['eslint-config-salesforce-typescript'], rules: { 'indent': ['error', 4], '@typescript-eslint/no-explicit-any': 'off' } };"},{"note":"For type-aware rules, you must specify `parserOptions.project` to point to your `tsconfig.json` file. Ensure the path is correct relative to the ESLint config file.","symbol":"TypeScript Parser Options","correct":"module.exports = { extends: ['eslint-config-salesforce-typescript'], parserOptions: { project: './tsconfig.json' } };"}],"quickstart":{"code":"yarn add eslint-config-salesforce-typescript eslint eslint-plugin-import eslint-plugin-prettier eslint-plugin-jsdoc @typescript-eslint/eslint-plugin @typescript-eslint/parser\n\n// Create a .eslintrc.js file in your project root:\n// .eslintrc.js\nmodule.exports = {\n  extends: [\n    'eslint-config-salesforce-typescript'\n  ],\n  // If you are using type-aware rules, uncomment and adjust the parserOptions\n  // parserOptions: {\n  //   project: './tsconfig.json'\n  // }\n  // Add any project-specific overrides here, e.g., to disable a rule:\n  // rules: {\n  //   '@typescript-eslint/no-explicit-any': 'off'\n  // }\n};\n\n// To run ESLint:\n// npx eslint src/","lang":"javascript","description":"This quickstart demonstrates how to install the configuration and its required peer dependencies, then set up a basic .eslintrc.js file to extend the Salesforce TypeScript ESLint rules."},"warnings":[{"fix":"Consult the project's GitHub repository or release notes for a full list of breaking changes and adjust your project's ESLint configuration and code accordingly.","message":"Major version 4.x introduces potential breaking changes compared to 3.x, adhering to semantic versioning. Review the official changelog for specific rule changes or removals when upgrading.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Ensure all required peer dependencies, as listed in the documentation and during installation, are installed using your package manager (e.g., `yarn add ...` or `npm install ...`).","message":"This configuration requires several peer dependencies (ESLint, various plugins, and TypeScript parser) to be installed explicitly in your project. Failing to install them will result in ESLint errors indicating missing modules.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add `parserOptions: { project: './tsconfig.json' }` to your `.eslintrc.js` file, adjusting the path to your primary `tsconfig.json` file relative to the ESLint config.","message":"For TypeScript type-aware rules to function correctly, you must specify `parserOptions.project` in your `.eslintrc` file, pointing to your `tsconfig.json`. Incorrect paths or missing `tsconfig.json` can lead to errors or rules not being applied.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Verify that `parserOptions.project` in your `.eslintrc` points to the correct `tsconfig.json` path and that your `tsconfig.json`'s `include` array covers the files being linted.","cause":"The `tsconfig.json` file specified in `parserOptions.project` either does not exist at the given path or does not include the files ESLint is trying to lint.","error":"Parsing error: 'parserOptions.project' has been set for @typescript-eslint/parser. The file does not match your project config."},{"fix":"Install the missing plugin: `yarn add eslint-plugin-import` or `npm install eslint-plugin-import`.","cause":"A required peer dependency, `eslint-plugin-import`, is not installed in the project.","error":"ESLint couldn't find the plugin 'eslint-plugin-import'."},{"fix":"Ensure your ESLint installation is up-to-date (`yarn add eslint@latest` or `npm install eslint@latest`). If using CommonJS, verify your `.eslintrc.js` uses `module.exports = { ... }` correctly. If in an ESM project, ensure your `.eslintrc.js` file name and contents are compatible with ESM, or consider using `.eslintrc.cjs`.","cause":"This error typically occurs when an older version of ESLint is trying to load a configuration or plugin that expects a newer ESLint API, or due to incorrect CommonJS `require()` syntax in an ES Modules environment.","error":"TypeError: ESLint is not a constructor"}],"ecosystem":"npm"}