{"id":13801836,"url":"https://github.com/selaux/eslint-plugin-filenames","last_synced_at":"2025-04-07T23:13:31.173Z","repository":{"id":23799754,"uuid":"27175687","full_name":"selaux/eslint-plugin-filenames","owner":"selaux","description":"Eslint plugin to check filenames.","archived":false,"fork":false,"pushed_at":"2024-07-27T11:13:08.000Z","size":60,"stargazers_count":322,"open_issues_count":26,"forks_count":36,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T22:26:08.035Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selaux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-26T12:25:07.000Z","updated_at":"2024-12-31T12:27:11.000Z","dependencies_parsed_at":"2025-01-19T21:02:02.710Z","dependency_job_id":"e6aa345b-eb4b-42d0-914a-dbb897e7de3f","html_url":"https://github.com/selaux/eslint-plugin-filenames","commit_stats":{"total_commits":56,"total_committers":10,"mean_commits":5.6,"dds":0.2321428571428571,"last_synced_commit":"32fc70dd7572211d1e5b97e06ec7a005c77fe8d4"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selaux%2Feslint-plugin-filenames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selaux%2Feslint-plugin-filenames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selaux%2Feslint-plugin-filenames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selaux%2Feslint-plugin-filenames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selaux","download_url":"https://codeload.github.com/selaux/eslint-plugin-filenames/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744335,"owners_count":20988783,"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-08-04T00:01:28.442Z","updated_at":"2025-04-07T23:13:31.150Z","avatar_url":"https://github.com/selaux.png","language":"JavaScript","funding_links":[],"categories":["Plugins","📦 Legacy \u0026 Inactive Projects"],"sub_categories":["Style"],"readme":"# eslint-plugin-filenames\n\n__This project is no longer actively maintained__\n\n[![NPM Version](https://img.shields.io/npm/v/eslint-plugin-filenames.svg?style=flat-square)](https://www.npmjs.org/package/eslint-plugin-filenames)\n[![Build Status](https://img.shields.io/travis/selaux/eslint-plugin-filenames.svg?style=flat-square)](https://travis-ci.org/selaux/eslint-plugin-filenames)\n[![Coverage Status](https://img.shields.io/coveralls/selaux/eslint-plugin-filenames.svg?style=flat-square)](https://coveralls.io/r/selaux/eslint-plugin-filenames?branch=master)\n[![Dependencies](https://img.shields.io/david/selaux/eslint-plugin-filenames.svg?style=flat-square)](https://david-dm.org/selaux/eslint-plugin-filenames)\n\nAdds [eslint](http://eslint.org/) rules to ensure consistent filenames for your javascript files.\n\n__Please note__: This plugin will only lint the filenames of the `.js`, `.jsx` files you are linting with eslint. It will ignore other files that are not linted with eslint.\n\n## Enabling the plugin\n\nThis plugin requires a version of `eslint\u003e=1.0.0` to be installed as a peer dependency.\n\nModify your `.eslintrc` file to load the plugin and enable the rules you want to use.\n\n```json\n{\n  \"plugins\": [\n    \"filenames\"\n  ],\n  \"rules\": {\n    \"filenames/match-regex\": 2,\n    \"filenames/match-exported\": 2,\n    \"filenames/no-index\": 2\n  }\n}\n```\n\n## Rules\n\n### Consistent Filenames via regex (match-regex)\n\nA rule to enforce a certain file naming convention using a regular expression.\n\nThe convention can be configured using a regular expression (the default is `camelCase.js`). Additionally\nexporting files can be ignored with a second configuration parameter.\n\n```json\n\"filenames/match-regex\": [2, \"^[a-z_]+$\", true]\n```\n\nWith these configuration options, `camelCase.js` will be reported as an error while `snake_case.js` will pass.\nAdditionally the files that have a named default export (according to the logic in the `match-exported` rule) will be\nignored.  They could be linted with the `match-exported` rule. Please note that exported function calls are not\nrespected in this case.\n\n### Matching Exported Values (match-exported)\n\nMatch the file name against the default exported value in the module. Files that dont have a default export will\nbe ignored. The exports of `index.js` are matched against their parent directory.\n\n```js\n// Considered problem only if the file isn't named foo.js or foo/index.js\nexport default function foo() {}\n\n// Considered problem only if the file isn't named Foo.js or Foo/index.js\nmodule.exports = class Foo() {}\n\n// Considered problem only if the file isn't named someVariable.js or someVariable/index.js\nmodule.exports = someVariable;\n\n// Never considered a problem\nexport default { foo: \"bar\" };\n```\n\nIf your filename policy doesn't quite match with your variable naming policy, you can add one or multiple transforms:\n\n```json\n\"filenames/match-exported\": [ 2, \"kebab\" ]\n```\n\nNow, in your code:\n\n```js\n// Considered problem only if file isn't named variable-name.js or variable-name/index.js\nexport default function variableName;\n```\n\nAvailable transforms:\n'[snake](https://www.npmjs.com/package/lodash.snakecase)',\n'[kebab](https://www.npmjs.com/package/lodash.kebabcase)',\n'[camel](https://www.npmjs.com/package/lodash.camelcase)', and\n'pascal' (camel-cased with first letter in upper case).\n\nFor multiple transforms simply specify an array like this (null in this case stands for no transform):\n\n```json\n\"filenames/match-exported\": [2, [ null, \"kebab\", \"snake\" ] ]\n```\n\nIf you prefer to use suffixes for your files (e.g. `Foo.react.js` for a React component file),\nyou can use a second configuration parameter. It allows you to remove parts of a filename matching a regex pattern\nbefore transforming and matching against the export.\n\n```json\n\"filenames/match-exported\": [ 2, null, \"\\\\.react$\" ]\n```\n\nNow, in your code:\n\n```js\n// Considered problem only if file isn't named variableName.react.js, variableName.js or variableName/index.js\nexport default function variableName;\n```\n\nIf you also want to match exported function calls you can use the third option (a boolean flag).\n\n```json\n\"filenames/match-exported\": [ 2, null, null, true ]\n```\n\nNow, in your code:\n\n```js\n// Considered problem only if file isn't named functionName.js or functionName/index.js\nexport default functionName();\n```\n\n### Don't allow index.js files (no-index)\n\nHaving a bunch of `index.js` files can have negative influence on developer experience, e.g. when\nopening files by name. When enabling this rule. `index.js` files will always be considered a problem.\n\n## Changelog\n\n#### 1.3.2\n\n- Fix issue with `match-regex` and `getExportedName`\n\n#### 1.3.1\n\n- Put breaking change from `1.3.0` behind a flag\n\n#### 1.3.0\n\n- Support call expressions as named exports\n\n#### 1.2.0\n- Introduce `strip` option for `match-exported`\n- Introduce support for multiple transform options\n- Introduce `pascal` transform\n\n#### 1.1.0\n- Introduce `transform` option for `match-exported`\n\n#### 1.0.0\n- Split rule into `match-regex`, `match-exported` and `no-index`\n\n#### 0.2.0\n- Add match-exported flags\n\n#### 0.1.2\n- Fix example in README\n\n#### 0.1.1\n- Fix: Text via stdin always passes\n- Tests: Travis builds also run on node 0.12 and iojs now\n\n#### 0.1.0\n- Initial Release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselaux%2Feslint-plugin-filenames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselaux%2Feslint-plugin-filenames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselaux%2Feslint-plugin-filenames/lists"}