{"id":21521128,"url":"https://github.com/weisjohn/eslint-lockdown","last_synced_at":"2025-03-17T17:16:46.684Z","repository":{"id":57229675,"uuid":"46203807","full_name":"weisjohn/eslint-lockdown","owner":"weisjohn","description":"generate an .eslintrc against a legacy codebase","archived":false,"fork":false,"pushed_at":"2015-11-18T09:58:07.000Z","size":23,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T08:06:06.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weisjohn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-15T04:10:55.000Z","updated_at":"2024-06-22T02:57:32.000Z","dependencies_parsed_at":"2022-09-12T22:30:42.953Z","dependency_job_id":null,"html_url":"https://github.com/weisjohn/eslint-lockdown","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weisjohn%2Feslint-lockdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weisjohn%2Feslint-lockdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weisjohn%2Feslint-lockdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weisjohn%2Feslint-lockdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weisjohn","download_url":"https://codeload.github.com/weisjohn/eslint-lockdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244075649,"owners_count":20393980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T01:06:11.365Z","updated_at":"2025-03-17T17:16:46.659Z","avatar_url":"https://github.com/weisjohn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eslint-lockdown\n\ngenerate an `.eslintrc` against a legacy codebase\n\n### usage\n\n```\n$ npm i -g eslint-lockdown\n$ eslint-lockdown\n```\n\n`eslint-lockdown` will generate an `.eslintrc` to utilize `eslint` against a legacy codebase. It reads in your (optional) current `.eslintrc` file and generates a new `.eslintrc` with failing rules marked as `warn`. This allows you to \"put a stake in the ground\" to prevent your code getting worse, utilizing `eslint` as part of your build process without halting development.\n\nBy default, `eslint-lockdown` will overwrite the `.eslintrc` file. To preview the results without overwriting:\n\n```\n$ eslint-lockdown --debug\n```\n\n### example\n\nThis snippet, `foo.js`:\n\n```javascript\nmodule.exports = function() {\n    var unused = true;\n    console.log(\"foobar\");\n}\n```\n\nviolates many `eslint:recommended` rules:\n\n```bash\n$ eslint foo.js\n\n/foo/bar/foo.js\n  1:1  error  \"module\" is not defined             no-undef\n  2:9  error  \"unused\" is defined but never used  no-unused-vars\n  3:5  error  Unexpected console statement        no-console\n  3:5  error  \"console\" is not defined            no-undef\n\n✖ 4 problems (4 errors, 0 warnings)\n```\n\nRunning `eslint-lockdown`, we would generate an `.eslintrc` file to make `eslint` pass:\n\n```json\n{\n    \"extends\": \"eslint:recommended\",\n    \"rules\": {\n        \"no-undef\": [ 1 ],\n        \"no-unused-vars\": [ 1 ],\n        \"no-console\": [ 1 ]\n    }\n}\n```\n\nAfter generating the new file, `eslint` will pass with warnings:\n\n```bash\n$ eslint .\n\n/Users/john/mysrc/weisjohn/scratch/eslint_lockdown/index.js\n  1:1  warning  \"module\" is not defined             no-undef\n  2:9  warning  \"unused\" is defined but never used  no-unused-vars\n  3:5  warning  Unexpected console statement        no-console\n  3:5  warning  \"console\" is not defined            no-undef\n\n✖ 4 problems (0 errors, 4 warnings)\n```\n\n### library\n\nIf you want to further wrangle the configuration, you can use `eslint-lockdown` as a node library:\n\n```\nvar lockdown = require('eslint-lockdown');\n\nlockdown(__dirname, function(err, config) {\n    if (err) return console.error(err);\n    console.log(config);\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweisjohn%2Feslint-lockdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweisjohn%2Feslint-lockdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweisjohn%2Feslint-lockdown/lists"}