{"id":13800827,"url":"https://github.com/atfzl/eslint-plugin-css-modules","last_synced_at":"2025-05-15T09:06:02.323Z","repository":{"id":48000737,"uuid":"76054142","full_name":"atfzl/eslint-plugin-css-modules","owner":"atfzl","description":"Project status: NOT MAINTAINED; Checks that you are using the existent css/scss classes, no more no less","archived":false,"fork":false,"pushed_at":"2024-11-29T18:51:12.000Z","size":693,"stargazers_count":153,"open_issues_count":36,"forks_count":34,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-14T14:06:18.684Z","etag":null,"topics":["css","css-modules","eslint","eslint-plugin","scss"],"latest_commit_sha":null,"homepage":"","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/atfzl.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":"2016-12-09T17:00:23.000Z","updated_at":"2025-05-14T04:50:27.000Z","dependencies_parsed_at":"2023-09-28T21:57:22.799Z","dependency_job_id":"847bad86-6ce6-4a83-baa4-18ea103c9691","html_url":"https://github.com/atfzl/eslint-plugin-css-modules","commit_stats":{"total_commits":105,"total_committers":10,"mean_commits":10.5,"dds":0.4666666666666667,"last_synced_commit":"f37dbcd577fb75a725838c4aafeedb7afe3c79ad"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atfzl%2Feslint-plugin-css-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atfzl%2Feslint-plugin-css-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atfzl%2Feslint-plugin-css-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atfzl%2Feslint-plugin-css-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atfzl","download_url":"https://codeload.github.com/atfzl/eslint-plugin-css-modules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254181234,"owners_count":22028126,"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":["css","css-modules","eslint","eslint-plugin","scss"],"created_at":"2024-08-04T00:01:16.666Z","updated_at":"2025-05-15T09:06:02.295Z","avatar_url":"https://github.com/atfzl.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["CSS in JS"],"readme":"# eslint-plugin-css-modules\n\n[![Build Status](https://travis-ci.org/atfzl/eslint-plugin-css-modules.svg?branch=master)](https://travis-ci.org/atfzl/eslint-plugin-css-modules)\n\nThis plugin intends to help you in tracking down problems when you are using css-modules. It tells if you are using a non-existent css/scss/less class in js or if you forgot to use some classes which you declared in css/scss/less.\n\n## Rules\n\n* `css-modules/no-unused-class`: You must use all the classes defined in css/scss/less file.\n\n\u003eIf you still want to mark a class as used, then use this comment on top of your file\n```js\n/* eslint css-modules/no-unused-class: [2, { markAsUsed: ['container'] }] */\n```\nwhere container is the css class that you want to mark as used.\nAdd all such classes in the array.\n\n\u003eIf you use the `camelCase` option of `css-loader`, you must also enabled it for this plugin\n```js\n/* eslint css-modules/no-unused-class: [2, { camelCase: true }] */\n```\n\n* `css-modules/no-undef-class`: You must not use a non existing class, or a property that hasn't been exported using the [:export keyword](https://github.com/css-modules/icss#export).\n\n\u003eIf you use the `camelCase` option of `css-loader`, you must also enabled it for this plugin\n```js\n/* eslint css-modules/no-undef-class: [2, { camelCase: true }] */\n```\n\n## Installation\n\n```\nnpm i --save-dev eslint-plugin-css-modules\n```\n\n## Usage:\n\n.eslintrc\n```json\n{\n  \"plugins\": [\n    \"css-modules\"\n  ],\n  \"extends\": [\n    \"plugin:css-modules/recommended\"\n  ]\n}\n```\n\nYou may also tweak the rules individually. For instance, if you use the [camelCase](https://github.com/webpack-contrib/css-loader#camelcase) option of webpack's css-loader:\n\n```json\n{\n  \"plugins\": [\n    \"css-modules\"\n  ],\n  \"extends\": [\n    \"plugin:css-modules/recommended\"\n  ],\n  \"rules\": {\n    \"css-modules/no-unused-class\": [2, { \"camelCase\": true }],\n    \"css-modules/no-undef-class\": [2, { \"camelCase\": true }]\n  }\n}\n```\n\nThe camelCase option has 4 possible values, see [css-loader#camelCase](https://github.com/webpack-contrib/css-loader#camelcase) for description:\n```js\ntrue | \"dashes\" | \"only\" | \"dashes-only\"\n```\n\n## Specifying base path\n\nYou can specify path for the base directory via plugin settings in .eslintrc. This is used by the plugin to resolve absolute (S)CSS paths:\n\n```json\n{\n  \"settings\": {\n    \"css-modules\": {\n      \"basePath\": \"app/scripts/...\"\n    }\n  }\n}\n```\n\n## Screen Shot\n\n![ScreenShot](https://raw.githubusercontent.com/atfzl/eslint-plugin-css-modules/master/screenshots/screenshot3.png)\n\n```\n   1:8   error  Unused classes found: container  css-modules/no-unused-class\n   5:17  error  Class 'containr' not found       css-modules/no-undef-class\n  10:26  error  Class 'foo' not found            css-modules/no-undef-class\n```\n\nscss:\n\n```scss\n/* .head is global, will not be used in js */\n:global(.head) {\n  color: green;\n}\n\n.container {\n  width: 116px;\n\n  i {\n    font-size: 2.2rem;\n  }\n\n  .button {\n    padding: 7px 0 0 5px;\n  }\n}\n\n.footer {\n  color: cyan;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatfzl%2Feslint-plugin-css-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatfzl%2Feslint-plugin-css-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatfzl%2Feslint-plugin-css-modules/lists"}