ESLint rules and shareable configs for Hardened JavaScript and Endo packages.
npm install --save-dev eslint @endo/eslint-plugin
In your eslint.config.js (or .mjs/.cjs):
import endoPlugin from '@endo/eslint-plugin';
export default [
// Apply the recommended rules for Hardened JS code.
...endoPlugin.configs['flat/recommended'],
];
In your .eslintrc.json (or .eslintrc.js, etc.):
{
"extends": ["plugin:@endo/recommended"]
}
recommended / flat/recommendedCore rules for code written to run under Hardened JavaScript (post-lockdown()).
// flat config
...endoPlugin.configs['flat/recommended']
// legacy
{ "extends": ["plugin:@endo/recommended"] }
Breaking change (v3): This config no longer bundles
@jessie.js/eslint-plugin. Consumers who want the Jessiesafe-await-separatorrule and theuse-jessieprocessor must install@jessie.js/eslint-pluginand configure it directly:import jessie from '@jessie.js/eslint-plugin';
import endo from '@endo/eslint-plugin';
export default [
...endo.configs['flat/recommended'],
...jessie.configs['flat/recommended'],
{ processor: jessie.processors['use-jessie'] },
];
recommended-requiring-type-checking / flat/recommended-requiring-type-checkingExtends recommended and adds the restrict-comparison-operands rule, which requires TypeScript type information.
// flat config
...endoPlugin.configs['flat/recommended-requiring-type-checking']
// legacy
{ "extends": ["plugin:@endo/recommended-requiring-type-checking"] }
style / flat/styleOpinionated JS coding-style rules: @stylistic/eslint-plugin, jsdoc, and prettier.
...endoPlugin.configs['flat/style']
imports / flat/importsRules about how packages should use imports: require file extensions, disallow extraneous dependencies, prefer named exports.
...endoPlugin.configs['flat/imports']
strict / flat/strictstyle + imports + recommended in one config.
...endoPlugin.configs['flat/strict']
internal / flat/internalThe opinionated baseline used by all packages within the Endo monorepo itself. Extends strict and adds TypeScript-ESLint. Not intended for external use.
...endoPlugin.configs['flat/internal']
ses / flat/sesExtends internal with strict global-variable restrictions for SES bootstrap code that runs before lockdown().
...endoPlugin.configs['flat/ses']
daemon / flat/daemon (deprecated)Alias for internal/flat/internal.
| Rule | Description | Fixable |
|---|---|---|
| @endo/assert-fail-as-throw | Make assert.fail() count as a throw in ESLint's control-flow analysis |
— |
| @endo/harden-exports | Ensure each named export is immediately followed by harden() |
🔧 |
| @endo/no-assign-to-exported-let-var-or-function | Disallow reassignment of exported let/var/function bindings |
— |
| @endo/no-harden-pattern-maker | Warn when hardening pattern-maker return values (they are already hardened) | — |
| @endo/no-multi-name-local-export | Disallow exporting the same local binding under multiple names | — |
| @endo/no-polymorphic-call | Disallow method calls on non-local receiver objects | — |
| @endo/restrict-comparison-operands | Restrict </>/<=/>= to operands of compatible types |
— |
// flat config
export default [
{
plugins: { '@endo': endoPlugin },
rules: {
'@endo/harden-exports': 'error',
'@endo/no-polymorphic-call': 'warn',
},
},
];
// legacy (.eslintrc.json)
{
"plugins": ["@endo"],
"rules": {
"@endo/harden-exports": "error",
"@endo/no-polymorphic-call": "warn"
}
}
| ESLint version | How to use |
|---|---|
| 9.x | eslint.config.js flat config, use flat/* configs |
| 8.x | .eslintrc.* legacy config, use bare config names |
The plugin ships both legacy (recommended, internal, …) and flat (flat/recommended, flat/internal, …) configs so you can use whichever ESLint version your project requires.