Registry / testing / eslint-config-salesforce-typescript

eslint-config-salesforce-typescript

JSON →
library4.0.1jsnpmunverified

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.

npm install eslint-config-salesforce-typescript
INSTALL
IMPORT
SIG · ESLINT-CONFIG-SALE
E
eslint-config-salesforce-typescript
testingjavascriptv4.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESLint Configuration Extension
module.exports = { extends: ['eslint-config-salesforce-typescript'] };
import { config } from 'eslint-config-salesforce-typescript';
ESLint configurations are applied via the 'extends' property in an .eslintrc file, not imported as modules in source code.
ESLint Rule Override
module.exports = { extends: ['eslint-config-salesforce-typescript'], rules: { 'indent': ['error', 4], '@typescript-eslint/no-explicit-any': 'off' } };
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.
TypeScript Parser Options
module.exports = { extends: ['eslint-config-salesforce-typescript'], parserOptions: { project: './tsconfig.json' } };
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.

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.

yarn add eslint-config-salesforce-typescript eslint eslint-plugin-import eslint-plugin-prettier eslint-plugin-jsdoc @typescript-eslint/eslint-plugin @typescript-eslint/parser // Create a .eslintrc.js file in your project root: // .eslintrc.js module.exports = { extends: [ 'eslint-config-salesforce-typescript' ], // If you are using type-aware rules, uncomment and adjust the parserOptions // parserOptions: { // project: './tsconfig.json' // } // Add any project-specific overrides here, e.g., to disable a rule: // rules: { // '@typescript-eslint/no-explicit-any': 'off' // } }; // To run ESLint: // npx eslint src/
Debug
Known issues
breakingMajor 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.
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.
affects: >=4.0.0
gotchaThis 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.
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 ...`).
affects: >=1.0.0
gotchaFor 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.
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.
affects: >=1.0.0
Errors
Common errors & fixes
Parsing error: 'parserOptions.project' has been set for @typescript-eslint/parser. The file does not match your project config.
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.
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.
ESLint couldn't find the plugin 'eslint-plugin-import'.
A required peer dependency, `eslint-plugin-import`, is not installed in the project.
fix
Install the missing plugin: `yarn add eslint-plugin-import` or `npm install eslint-plugin-import`.
TypeError: ESLint is not a constructor
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.
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`.
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
eslintrequiredCore ESLint engine, required to run linting.
eslint-plugin-importrequiredESLint plugin for import/export syntax, part of the core configuration.
eslint-plugin-prettierrequiredIntegrates Prettier formatting into ESLint rules.
eslint-plugin-jsdocrequiredEnforces JSDoc comment conventions.
@typescript-eslint/eslint-pluginrequiredTypeScript specific ESLint rules.
@typescript-eslint/parserrequiredParser for TypeScript files, allowing ESLint to understand TypeScript syntax.
eslint-config-salesforce-licenseoptionalOptional: For Salesforce-owned repositories, extends license checking rules.
Agent activity
10 hits · last 30 days
node
10
Resources
eslint-config-salesforce-typescript — npm install eslint-config-salesforce-typescript · libregistry