CodeSampleX

Exemplo

@eslint/eslintrc 3.3.7: FlatCompat, Legacy

Amostra verificada para npm @eslint/eslintrc 3.3.7: FlatCompat, Legacy. O contrato rodou em node 22 · linux debian/x64 · docker e passou.

sha256:130f29cf9d3cb53494a2f422cb364c7e040f3d44a3579b9f8ac29d83f41187a6

Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu. Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas. MIT-0

Evidência de execução

O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.

Base da evidência
Contrato assinado aprovado
Recibos de verificação
1
Chaves de assinatura que o compilaram
1
Ambiente declarado node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm

Ambientes das execuções de verificação

Ambiente Contrato Etapas Execução
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-09-19

Caso

HOW
Objetivo
verify pkg:npm/%40eslint/eslintrc@3.3.7
Pacotes
Símbolos
  • @eslint/eslintrc.FlatCompat
  • @eslint/eslintrc.Legacy
Ambiente
node 22.23.2
Criado
2026-09-18T19:16:20Z

Contrato

  1. assert FlatCompat instantiates with baseDirectory and configuration presets
  2. assert FlatCompat.config translates legacy eslintrc rules and settings into flat config objects
  3. assert FlatCompat.env translates legacy env flags into languageOptions globals
  4. assert FlatCompat.extends translates recommendedConfig via extends('eslint:recommended')
  5. assert Legacy.environments exposes predefined environment configs with builtin globals
  6. assert Legacy.naming normalizes plugin package names with prefixes and resolves shorthand identifiers
  7. assert Legacy.ConfigOps resolves and checks rule severity values across numeric, string, and array formats

Arquivos

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.js

Baixar o artefato de código-fonte (tar.gz)

Código-fonte

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify pkg:npm/%40eslint/eslintrc@3.3.7
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40eslint/eslintrc@3.3.7
Demonstrate these symbols/APIs:
  - @eslint/eslintrc.FlatCompat
  - @eslint/eslintrc.Legacy

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:a288d6853bc44d4f505d0f6569c1e4b72c333bf819a188658dfa11b7bade1f2d","contract":["assert FlatCompat instantiates with baseDirectory and configuration presets","assert FlatCompat.config translates legacy eslintrc rules and settings into flat config objects","assert FlatCompat.env translates legacy env flags into languageOptions globals","assert FlatCompat.extends translates recommendedConfig via extends('eslint:recommended')","assert Legacy.environments exposes predefined environment configs with builtin globals","assert Legacy.naming normalizes plugin package names with prefixes and resolves shorthand identifiers","assert Legacy.ConfigOps resolves and checks rule severity values across numeric, string, and array formats"],"goal":"verify pkg:npm/%40eslint/eslintrc@3.3.7","kind":"HOW","packages":["pkg:npm/%40eslint/eslintrc@3.3.7"],"schemaVersion":1,"symbols":["@eslint/eslintrc.FlatCompat","@eslint/eslintrc.Legacy"]},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40eslint/eslintrc@3.3.7"],"schemaVersion":1,"subject":"pkg:npm/%40eslint/eslintrc@3.3.7","symbols":["@eslint/eslintrc.FlatCompat","@eslint/eslintrc.Legacy"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-eslint-eslintrc",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-eslint-eslintrc",
      "version": "1.0.0",
      "dependencies": {
        "@eslint/eslintrc": "3.3.7"
      }
    },
    "node_modules/@eslint/eslintrc": {
      "version": "3.3.7",
      "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.7.tgz",
      "integrity": "sha512-F42g89Qd5oAWtp0k0nnSrjziAKza7w8SVT4mStc18LZMaRb4J1HQAHLCalEtDCxrTuksx7NU9qsmeLwpOfPqWw==",
      "license": "MIT",
      "dependencies": {
        "ajv": "^6.14.0",
        "debug": "^4.3.2",
        "espree": "^10.0.1",
        "globals": "^14.0.0",
        "ignore": "^5.2.0",
        "import-fresh": "^3.2.1",
        "js-yaml": "^4.3.2",
        "minimatch": "^3.1.5",
        "strip-json-comments": "^3.1.1"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    },
    "node_modules/acorn": {
      "version": "8.18.0",
      "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz",
      "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
      "license": "MIT",
      "bin": {
        "acorn": "bin/acorn"
      },
      "engines": {
        "node": ">=0.4.0"
      }
    },
    "node_modules/acorn-jsx": {
      "version": "5.3.2",
      "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
      "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
      "license": "MIT",
      "peerDependencies": {
        "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
      }
    },
    "node_modules/ajv": {
      "version": "6.15.0",
      "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
      "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
      "license": "MIT",
      "dependencies": {
        "fast-deep-equal": "^3.1.1",
        "fast-json-stable-stringify": "^2.0.0",
        "json-schema-traverse": "^0.4.1",
        "uri-js": "^4.2.2"
      },
      "funding": {
        "type": "github",
        "url": "https://github.com/sponsors/epoberezkin"
      }
    },
    "node_modules/argparse": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
      "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
      "license": "Python-2.0"
    },
    "node_modules/balanced-match": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
      "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
      "license": "MIT"
    },
    "node_modules/brace-expansion": {
      "version": "1.1.21",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz",
      "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==",
      "license": "MIT",
      "dependencies": {
        "balanced-match": "^1.0.0",
        "concat-map": "0.0.1"
      }
    },
    "node_modules/callsites": {
      "version": "3.1.0",
      "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
      "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
      "license": "MIT",
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/concat-map": {
      "version": "0.0.1",
      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
      "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
      "license": "MIT"
    },
    "node_modules/debug": {
      "version": "4.4.3",
      "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
      "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
      "license": "MIT",
      "dependencies": {
        "ms": "^2.1.3"
      },
      "engines": {
        "node": ">=6.0"
      },
      "peerDependenciesMeta": {
        "supports-color": {
          "optional": true
        }
      }
    },
    "node_modules/eslint-visitor-keys": {
      "version": "4.2.1",
      "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
      "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
      "license": "Apache-2.0",
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    },
    "node_modules/espree": {
      "version": "10.4.0",
      "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
      "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
      "license": "BSD-2-Clause",
      "dependencies": {
        "acorn": "^8.15.0",
        "acorn-jsx": "^5.3.2",
        "eslint-visitor-keys": "^4.2.1"
      },
      "engines": {
        "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
      },
      "funding": {
        "url": "https://opencollective.com/eslint"
      }
    },
    "node_modules/fast-deep-equal": {
      "version": "3.1.3",
      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
      "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
      "license": "MIT"
    },
    "node_modules/fast-json-stable-stringify": {
      "version": "2.1.0",
      "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
      "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
      "license": "MIT"
    },
    "node_modules/globals": {
      "version": "14.0.0",
      "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
      "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
      "license": "MIT",
      "engines": {
        "node": ">=18"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },
    "node_modules/ignore": {
      "version": "5.3.2",
      "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
      "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
      "license": "MIT",
      "engines": {
        "node": ">= 4"
      }
    },
    "node_modules/import-fresh": {
      "version": "3.3.1",
      "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
      "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
      "license": "MIT",
      "dependencies": {
        "parent-module": "^1.0.0",
        "resolve-from": "^4.0.0"
      },
      "engines": {
        "node": ">=6"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },
    "node_modules/js-yaml": {
      "version": "4.3.2",
      "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
      "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
      "funding": [
        {
          "type": "github",
          "url": "https://github.com/sponsors/puzrin"
        },
        {
          "type": "github",
          "url": "https://github.com/sponsors/nodeca"
        }
      ],
      "license": "MIT",
      "dependencies": {
        "argparse": "^2.0.1"
      },
      "bin": {
        "js-yaml": "bin/js-yaml.js"
      }
    },
    "node_modules/json-schema-traverse": {
      "version": "0.4.1",
      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
      "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
      "license": "MIT"
    },
    "node_modules/minimatch": {
      "version": "3.1.5",
      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
      "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
      "license": "ISC",
      "dependencies": {
        "brace-expansion": "^1.1.7"
      },
      "engines": {
        "node": "*"
      }
    },
    "node_modules/ms": {
      "version": "2.1.3",
      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
      "license": "MIT"
    },
    "node_modules/parent-module": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
      "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
      "license": "MIT",
      "dependencies": {
        "callsites": "^3.0.0"
      },
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/punycode": {
      "version": "2.3.1",
      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
      "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
      "license": "MIT",
      "engines": {
        "node": ">=6"
      }
    },
    "node_modules/resolve-from": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
      "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
      "license": "MIT",
      "engines": {
        "node": ">=4"
      }
    },
    "node_modules/strip-json-comments": {
      "version": "3.1.1",
      "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
      "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
      "license": "MIT",
      "engines": {
        "node": ">=8"
      },
      "funding": {
        "url": "https://github.com/sponsors/sindresorhus"
      }
    },
    "node_modules/uri-js": {
      "version": "4.4.1",
      "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
      "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
      "license": "BSD-2-Clause",
      "dependencies": {
        "punycode": "^2.1.0"
      }
    }
  }
}
package.json
{
  "name": "sample-eslint-eslintrc",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@eslint/eslintrc": "3.3.7"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40eslint/eslintrc@3.3.7",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40eslint/eslintrc@3.3.7"
  ],
  "symbols": [
    "@eslint/eslintrc.FlatCompat",
    "@eslint/eslintrc.Legacy"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const { FlatCompat, Legacy } = require("@eslint/eslintrc");

function createCompat(options = {}) {
  return new FlatCompat({
    baseDirectory: options.baseDirectory || process.cwd(),
    recommendedConfig: options.recommendedConfig,
    allConfig: options.allConfig,
    resolvePluginsRelativeTo: options.resolvePluginsRelativeTo,
  });
}

function translateConfig(compat, config) {
  return compat.config(config);
}

function translateEnv(compat, env) {
  return compat.env(env);
}

function translateExtends(compat, ...configs) {
  return compat.extends(...configs);
}

function getPredefinedEnvironment(envName) {
  return Legacy.environments.get(envName);
}

function normalizePluginName(name, prefix) {
  return Legacy.naming.normalizePackageName(name, prefix);
}

function checkRuleSeverity(ruleConfig) {
  return Legacy.ConfigOps.getRuleSeverity(ruleConfig);
}

module.exports = {
  createCompat,
  translateConfig,
  translateEnv,
  translateExtends,
  getPredefinedEnvironment,
  normalizePluginName,
  checkRuleSeverity,
};
test/contract.js
const assert = require("node:assert");
const { FlatCompat } = require("@eslint/eslintrc");
const {
  createCompat,
  translateConfig,
  translateEnv,
  translateExtends,
  getPredefinedEnvironment,
  normalizePluginName,
  checkRuleSeverity,
} = require("../src/index.js");

// 1. assert FlatCompat instantiates with baseDirectory and configuration presets
const compat = createCompat({
  baseDirectory: process.cwd(),
  recommendedConfig: {
    rules: {
      "no-undef": "error",
      "no-unused-vars": "error",
    },
  },
  allConfig: {
    rules: {
      semi: ["error", "always"],
    },
  },
});
assert(compat instanceof FlatCompat, "compat should be an instance of FlatCompat");

// 2. assert FlatCompat.config translates legacy eslintrc rules and settings into flat config objects
const flatConfigs = translateConfig(compat, {
  rules: {
    "no-console": "warn",
    semi: ["error", "never"],
  },
  settings: {
    framework: "node",
  },
});
assert(Array.isArray(flatConfigs), "translateConfig should return an array");
const ruleConfig = flatConfigs.find((c) => c.rules && c.rules["no-console"]);
assert(ruleConfig, "should translate rules object");
assert.strictEqual(ruleConfig.rules["no-console"], "warn");
assert.deepStrictEqual(ruleConfig.rules["semi"], ["error", "never"]);
const settingsConfig = flatConfigs.find((c) => c.settings && c.settings.framework);
assert(settingsConfig, "should translate settings object");
assert.strictEqual(settingsConfig.settings.framework, "node");

// 3. assert FlatCompat.env translates legacy env flags into languageOptions globals
const envConfigs = translateEnv(compat, {
  es2021: true,
  node: true,
});
assert(Array.isArray(envConfigs), "translateEnv should return an array");
const nodeGlobalConfig = envConfigs.find(
  (c) => c.languageOptions && c.languageOptions.globals && c.languageOptions.globals.process !== undefined
);
assert(nodeGlobalConfig, "should translate node environment to process global");
assert.strictEqual(nodeGlobalConfig.languageOptions.globals.process, false);

// 4. assert FlatCompat.extends translates recommendedConfig via extends('eslint:recommended')
const extConfigs = translateExtends(compat, "eslint:recommended");
assert(Array.isArray(extConfigs), "translateExtends should return an array");
const recRuleConfig = extConfigs.find((c) => c.rules && c.rules["no-undef"]);
assert(recRuleConfig, "should translate eslint:recommended rules");
assert.strictEqual(recRuleConfig.rules["no-undef"], "error");

// 5. assert Legacy.environments exposes predefined environment configs with builtin globals
const browserEnv = getPredefinedEnvironment("browser");
assert(browserEnv && browserEnv.globals, "browser environment should have globals defined");
assert.strictEqual(browserEnv.globals.window, false);

// 6. assert Legacy.naming normalizes plugin package names with prefixes and resolves shorthand identifiers
const normalizedPlugin = normalizePluginName("foo", "eslint-plugin");
assert.strictEqual(normalizedPlugin, "eslint-plugin-foo");

// 7. assert Legacy.ConfigOps resolves and checks rule severity values across numeric, string, and array formats
assert.strictEqual(checkRuleSeverity(["error", "always"]), 2);
assert.strictEqual(checkRuleSeverity("warn"), 1);
assert.strictEqual(checkRuleSeverity("off"), 0);

console.log("PASS: @eslint/eslintrc contract assertions verified");

Seeder de origem

anônimo