@tylertech-eslint/eslint-plugin
v4.0.0
Published
Shared ESLint rules and configurations that adhere to the standards and best practices of Tyler Technologies.
Readme
Tyler Tech ESLint Plugin
An ESLint plugin with the Tyler Tech recommended rules and configurations for JavaScript and TypeScript files. This plugin builds on top of the recommended ESLint and TypeScript ESLint rules, providing additional custom rules and configurations tailored to the standards and best practices of Tyler Technologies.
Installation
To install the package run the following command:
npm install -D @tylertech-eslint/eslint-pluginRequirements
- ESLint: v9 or above
- typescript-eslint: v8.0.0 or above (optional, only required when using TypeScript configurations)
Usage
This package uses the ESLint flat config format only, and is compatible with ESLint v9 and above.
To use it, set up your ESLint config file as follows:
- Create a file named
eslint.config.js(use the.mjsextension if your package does not use"type": "module") in the root of your project if it doesn't already exist. - Import the plugin and define your ESLint configuration using the
defineConfigfunction. This will help with type checking and autocompletion in IDEs that support it. - Create a config and specify the
filesto target, and add anextendsarray with the configs you want to apply to those files. - Optionally, you can also specify files or directories to ignore.
// eslint.config.js
import { defineConfig } from 'eslint/config';
import tylerPlugin from '@tylertech-eslint/eslint-plugin';
export default defineConfig([
// Specify which TypeScript files the `tsRecommended` config should apply to
{
files: ['**/*.ts'],
extends: [tylerPlugin.configs.tsRecommended],
rules: {
// If applicable, set any specific rules you want to add or override here
}
},
// If you want to lint just JavaScript files separately, you can extend just the `recommended` config
{
files: ['**/*.{js,mjs}'],
extends: [tylerPlugin.configs.recommended],
rules: {
// If applicable, set any specific rules you want to add or override here
}
},
// Optionally ignore specific files or directories
{ ignores: ['path/to/some/directory/**/*', 'path/to/a/file.ts'] }
]);Configurations
This plugin provides the following configs:
| Config Name | Description |
|--------------------|-------------|
| recommended | A recommended set of rules for JavaScript files. Extends the ESLint recommended config. |
| strict | A strict set of rules for JavaScript files. Extends the recommended config. |
| tsRecommended | A recommended set of rules for TypeScript files. Extends the TypeScript ESLint recommended config. |
| tsStylistic | A stylistic set of rules for TypeScript files, Extends the TypeScript ESLint stylistic config. |
| tsStrict | A strict set of rules for TypeScript files. Extends the tsRecommended config. |
Custom Rules
This plugin includes the following custom rules:
| Rule Name | Description | Default Severity |
|----------------------------------------------------|-------------| -----------------|
| @tylertech-eslint/invalid-relative-import-prefix | Disallows relative imports that start with ./../. | error |
| @tylertech-eslint/require-private-modifier | Enforces the use of the private modifier for class members that start with an underscore (_). | error |
| @tylertech-eslint/require-private-underscore | Enforces the use of an underscore (_) prefix for class members that are marked as private. | error |
