
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
@susisu/eslint-plugin-safe-typescript
Advanced tools
ESLint plugin that makes your TypeScript code safer
An ESLint plugin that makes your TypeScript code safer
This plugin requires TypeScript and typescript-eslint. If you haven't installed them in your project, follow the guide on typescript-eslint's Getting Started page.
Once you're ready, install this plugin:
# npm
npm i --save-dev @susisu/eslint-plugin-safe-typescript
# yarn
yarn add -D @susisu/eslint-plugin-safe-typescript
# pnpm
pnpm add -D @susisu/eslint-plugin-safe-typescript
@susisu/eslint-plugin-safe-typescript
to pluginsparserOptions.project
if you enable rules that use type information.eslint.config.js
:
import tsEslint from "typescript-eslint";
import safeTsPlugin from "@susisu/eslint-plugin-safe-typescript";
export default [
{
languageOptions: {
parser: tsEslint.parser, // (1)
parserOptions: {
project: true, // (3)
},
},
plugins: {
"@susisu/safe-typescript": safeTsPlugin, // (2)
},
rules: {
"@susisu/safe-typescript/no-object-assign": "error",
},
},
];
.eslintrc
:
{
"parser": "@typescript-eslint/parser", // (1)
"parserOptions": {
"project": true // (3)
},
"plugins": ["@susisu/safe-typescript"], // (2)
"rules": {
"@susisu/safe-typescript/no-object-assign": "error"
}
}
This plugin also provides a configuration set for the recommended rules (see Rules for which rules are recommended).
Since some rules in the recommended configuration require type information, parserOptions.project
must be set in your config.
eslint.config.js
export default [
safeTsPlugin.configs.recommended,
// or extend in `rules`
// {
// rules: {
// ...safeTsPlugin.configs.recommended.rules,
// },
// },
];
eslintrc
{
"extends": ["plugin:@susisu/safe-typescript/recommended"]
}
✅ = recommended, 🔧 = fixable, 💭 = requires type information
Name | Description | ✅ | 🔧 | 💭 |
---|---|---|---|---|
no-object-assign | Disallow the use of Object.assign() . | ✅ | ||
no-type-assertion | Disallow type assertions like x as T . | ✅ | ||
no-unsafe-object-enum-method | Disallow possibly unsafe property enumeration methods of Object . | ✅ | 💭 | |
no-unsafe-object-property-check | Disallow possibly unsafe property checks of object. | ✅ | 💭 | |
no-unsafe-object-property-overwrite | Disallow possibly unsafe overwrites of object properties. | ✅ | 💭 |
Issues and PRs are welcome! Feel free to open issues if you have any problems or ideas.
FAQs
ESLint plugin that makes your TypeScript code safer
The npm package @susisu/eslint-plugin-safe-typescript receives a total of 2,497 weekly downloads. As such, @susisu/eslint-plugin-safe-typescript popularity was classified as popular.
We found that @susisu/eslint-plugin-safe-typescript demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.