Skip to main content

@codelaw/rules-js · codelaw-rules-js

codelaw's core JavaScript rules, which also run on TypeScript, JSX and TSX — one of codelaw's first-party rule packs (SR-RULE-PACKS). The same files ship on npm as @codelaw/rules-js and on PyPI as codelaw-rules-js.

# codelaw.toml
extends = ["codelaw:js/recommended"]
preview = true   # every rule is `preview` until a corpus run promotes it

Presets

preset rules ported from
js/recommended 64 ESLint js.configs.recommended, @eslint/js 10.0.1 — all 64 rules
js/typescript 4 the four core rules typescript-eslint 8.71.2's eslint-recommended switches on for TypeScript: js/no-var, js/prefer-const, js/prefer-rest-params, js/prefer-spread; use it with codelaw:ts/recommended
js/conventions 3 codelaw's starter catalogue: js/exports-at-end, js/import-groups, js/no-default-export — opt in
js/project 1 graph/no-unused-exports, the rule that reads the whole repo, from knip's exports and types — opt in

Rules that typescript-eslint's eslint-recommended switches off for TypeScript (no-undef, no-redeclare, no-dupe-class-members and the rest, which the compiler checks) declare only javascript and jsx here. The four rules in js/typescript declare all four languages, so they also run on JavaScript files when that preset is on.

Every rule is reimplemented, not vendored: the matchers, messages and docs are written fresh, and each rule's ported_from: names the source rule.

How the ports differ

Every rule matches its source's documented behaviour on the source's own examples. Where codelaw differs, the rule's ## Differences from the source section says so. The larger ones:

rule difference
js/constructor-super, js/no-this-before-super follow the constructor's statements in straight-line order; a super() on any branch counts
js/no-constant-condition literal conditions only; ESLint also folds typeof x, !1 and similar
js/no-extra-boolean-cast !!x in a condition; Boolean(x) in a condition is not checked yet
js/no-invalid-regexp structural problems only (brackets, groups, quantifiers, flags)
js/no-useless-assignment dead stores a straight-line reading proves; ESLint follows every code path
js/no-useless-escape strings and templates; escapes inside regular expressions are not checked yet
js/no-undef environments come from the env option (shared-node-browser by default), using the globals data tables
js/prefer-spread only f.apply(null, args) on a plain function name
js/no-var suggest, not auto: let is block-scoped, so the swap can change meaning

Nothing from js.configs.recommended is left out.

Data

data/globals/*.json — the globals of each environment js/no-undef's env option names, from the globals package 17.13.0 (MIT). See NOTICE.

Metadata

Release files for codelaw-rules-js 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for codelaw-rules-js 0.2.0
File Interpreter ABI Platform Actions
codelaw_rules_js-0.2.0-py3-none-any.whl Python 3 none any Details for codelaw_rules_js-0.2.0-py3-none-any.whl

Release files / codelaw_rules_js-0.2.0-py3-none-any.whl

Download URL codelaw_rules_js-0.2.0-py3-none-any.whl
Size 79.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bd19a2db43a230db37837edc9f9a1f56412648f02dd90447cc9bf109b0e6bff
BLAKE2b-256 checksum
How to use checksums
ff681b061cedf0de0bfe4d0a44d2765296c52142f1fd71c70692bdcbdd6f3fad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for codelaw-rules-js 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page