eslint-plugin-conventions 7.0.1 → 7.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,63 @@
1
+ <!-- Generated by scripts/generate-plugin-agents-md.ts from package.json and the plugin exports. Do not edit by hand; run `npm run agents-md`. -->
2
+
3
+ # eslint-plugin-conventions
4
+
5
+ Guide for AI coding assistants using this plugin in a project. To change the plugin's own source, read https://github.com/ofri-peretz/eslint/blob/main/AGENTS.md instead.
6
+
7
+ > ESLint conventions rules for team code — enforces filename case, magic-number bans, commented-out code, expiring TODOs, and deprecated-API usage.
8
+
9
+ ## Enable it
10
+
11
+ ```bash
12
+ npm install --save-dev eslint-plugin-conventions
13
+ ```
14
+
15
+ Requires ESLint ^8.40.0 || ^9.0.0 || ^10.0.0 and Node >=22.13.0.
16
+
17
+ Flat config files (`eslint.config.*`) are found by ESLint 8.57 and newer; on ESLint 9 and 10 they are the default.
18
+
19
+ ```js
20
+ // eslint.config.mjs
21
+ import conventions from 'eslint-plugin-conventions';
22
+
23
+ export default [conventions.configs.recommended];
24
+ ```
25
+
26
+ Each preset is one flat config object: put it in the array as an element, do not spread it. Rule ids are prefixed `conventions/`. Add it to the config you already have; do not remove other plugins. TypeScript files need a TypeScript parser in the config (`typescript-eslint`).
27
+
28
+ ## Presets
29
+
30
+ | Preset | Rules | Errors | Warnings |
31
+ | ------------- | ----- | ------ | -------- |
32
+ | `recommended` | 6 | 3 | 3 |
33
+
34
+ ### `recommended`
35
+
36
+ 6 rules:
37
+
38
+ - `no-commented-code` (warn): Detects commented-out code blocks.
39
+ - `expiring-todo-comments` (warn): Add expiration conditions to TODO comments to prevent forgotten tasks.
40
+ - `no-deprecated-api` (warn): Prevent usage of deprecated APIs with migration context.
41
+ - `utm-taxonomy` (error): Validate utm_source and utm_medium values against the fixed taxonomy in UTM_PHILOSOPHY.md.
42
+ - `no-raw-cross-property-href` (error): Forbid hand-written cross-property hrefs; use buildUtmHref() from lib/utm.ts.
43
+ - `analytics-event-naming` (error): Analytics event names (track/capture) must follow ANALYTICS_PHILOSOPHY.md principle 4: lowercase snake_case, category:object_action, fixed verb list.
44
+
45
+ ### Rules in no preset
46
+
47
+ Enable these by name (`'conventions/<rule>': 'error'`):
48
+
49
+ - `prefer-code-point`: Prefer codePointAt over charCodeAt for proper Unicode character handling.
50
+ - `prefer-dom-node-text-content`: Prefer textContent over innerText for better performance and reliability.
51
+ - `no-console-spaces`: Prevent leading/trailing space between console.log parameters.
52
+ - `prefer-dependency-version-strategy`: Enforce consistent version strategy (caret, tilde, exact, etc.) for package.json dependencies.
53
+ - `filename-case`: Enforce filename case conventions for consistency.
54
+ - `consistent-existence-index-check`: Enforce consistent style for checking object property existence.
55
+ - `no-json-schema-tags`: Disallow JSON Schema keywords used as JSDoc tags (e.g. @minimum, @maximum).
56
+ - `require-data-testid`: Require stable `data-testid` attributes on interactive elements and custom components for testability.
57
+ - `no-magic-numbers`: Disallow magic numbers (numeric literals without a named constant).
58
+
59
+ ## More
60
+
61
+ - Docs: https://eslint.interlace.tools/docs/quality/plugin-conventions
62
+ - README.md in this package: every rule with examples.
63
+ - `eslint-plugin-conventions/oxlint` is an entry point for oxlint's JS plugin support; see the README.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-conventions",
3
- "version": "7.0.1",
4
- "description": "ESLint plugin for team code conventions — enforces filename case, magic-number bans, commented-out code, expiring TODOs, and deprecated-API usage.",
3
+ "version": "7.0.3",
4
+ "description": "ESLint conventions rules for team code — enforces filename case, magic-number bans, commented-out code, expiring TODOs, and deprecated-API usage.",
5
5
  "type": "commonjs",
6
6
  "sideEffects": false,
7
7
  "main": "./src/index.js",
@@ -24,7 +24,8 @@
24
24
  "files": [
25
25
  "src/",
26
26
  "README.md",
27
- "LICENSE"
27
+ "LICENSE",
28
+ "AGENTS.md"
28
29
  ],
29
30
  "keywords": [
30
31
  "eslint",
@@ -51,7 +52,7 @@
51
52
  "node": ">=22.13.0"
52
53
  },
53
54
  "dependencies": {
54
- "@interlace/eslint-devkit": "^2.0.1"
55
+ "@interlace/eslint-devkit": "^2.0.4"
55
56
  },
56
57
  "repository": {
57
58
  "type": "git",
package/src/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"no-commented-code"(){return require("./rules/conventions/no-commented-code").noCommentedCode},get"expiring-todo-comments"(){return require("./rules/conventions/expiring-todo-comments").expiringTodoComments},get"prefer-code-point"(){return require("./rules/conventions/prefer-code-point").preferCodePoint},get"prefer-dom-node-text-content"(){return require("./rules/conventions/prefer-dom-node-text-content").preferDomNodeTextContent},get"no-console-spaces"(){return require("./rules/conventions/no-console-spaces").noConsoleSpaces},get"no-deprecated-api"(){return require("./rules/deprecation/no-deprecated-api").noDeprecatedApi},get"prefer-dependency-version-strategy"(){return require("./rules/conventions/prefer-dependency-version-strategy").preferDependencyVersionStrategy},get"filename-case"(){return require("./rules/conventions/filename-case").filenameCase},get"consistent-existence-index-check"(){return require("./rules/conventions/consistent-existence-index-check").consistentExistenceIndexCheck},get"no-json-schema-tags"(){return require("./rules/conventions/no-json-schema-tags").noJsonSchemaTags},get"require-data-testid"(){return require("./rules/conventions/require-data-testid").requireDataTestId},get"utm-taxonomy"(){return require("./rules/conventions/utm-taxonomy").utmTaxonomy},get"no-raw-cross-property-href"(){return require("./rules/conventions/no-raw-cross-property-href").noRawCrossPropertyHref},get"analytics-event-naming"(){return require("./rules/conventions/analytics-event-naming").analyticsEventNaming},get"no-magic-numbers"(){return require("./rules/conventions/no-magic-numbers").noMagicNumbers}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-conventions",exports.rules);exports.plugin={meta:{name:"eslint-plugin-conventions",version:"7.0.1"},rules:exports.rules};exports.configs={recommended:{plugins:{conventions:exports.plugin},rules:{"conventions/no-commented-code":"warn","conventions/expiring-todo-comments":"warn","conventions/no-deprecated-api":"warn","conventions/utm-taxonomy":"error","conventions/no-raw-cross-property-href":"error","conventions/analytics-event-naming":"error"}}};exports.default=exports.plugin;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"no-commented-code"(){return require("./rules/conventions/no-commented-code").noCommentedCode},get"expiring-todo-comments"(){return require("./rules/conventions/expiring-todo-comments").expiringTodoComments},get"prefer-code-point"(){return require("./rules/conventions/prefer-code-point").preferCodePoint},get"prefer-dom-node-text-content"(){return require("./rules/conventions/prefer-dom-node-text-content").preferDomNodeTextContent},get"no-console-spaces"(){return require("./rules/conventions/no-console-spaces").noConsoleSpaces},get"no-deprecated-api"(){return require("./rules/deprecation/no-deprecated-api").noDeprecatedApi},get"prefer-dependency-version-strategy"(){return require("./rules/conventions/prefer-dependency-version-strategy").preferDependencyVersionStrategy},get"filename-case"(){return require("./rules/conventions/filename-case").filenameCase},get"consistent-existence-index-check"(){return require("./rules/conventions/consistent-existence-index-check").consistentExistenceIndexCheck},get"no-json-schema-tags"(){return require("./rules/conventions/no-json-schema-tags").noJsonSchemaTags},get"require-data-testid"(){return require("./rules/conventions/require-data-testid").requireDataTestId},get"utm-taxonomy"(){return require("./rules/conventions/utm-taxonomy").utmTaxonomy},get"no-raw-cross-property-href"(){return require("./rules/conventions/no-raw-cross-property-href").noRawCrossPropertyHref},get"analytics-event-naming"(){return require("./rules/conventions/analytics-event-naming").analyticsEventNaming},get"no-magic-numbers"(){return require("./rules/conventions/no-magic-numbers").noMagicNumbers}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-conventions",exports.rules);exports.plugin={meta:{name:"eslint-plugin-conventions",version:"7.0.3"},rules:exports.rules};exports.configs={recommended:{plugins:{conventions:exports.plugin},rules:{"conventions/no-commented-code":"warn","conventions/expiring-todo-comments":"warn","conventions/no-deprecated-api":"warn","conventions/utm-taxonomy":"error","conventions/no-raw-cross-property-href":"error","conventions/analytics-event-naming":"error"}}};exports.default=exports.plugin;