{"id":15386637,"url":"https://github.com/christianmurphy/selective","last_synced_at":"2025-04-12T01:43:27.560Z","repository":{"id":27888481,"uuid":"115014740","full_name":"ChristianMurphy/selective","owner":"ChristianMurphy","description":"Statically find HTML anti patterns using CSS Selectors","archived":false,"fork":false,"pushed_at":"2025-04-04T23:21:48.000Z","size":5474,"stargazers_count":14,"open_issues_count":26,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T00:26:02.103Z","etag":null,"topics":["accessibility","css-selector","lint","linter","rehype"],"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/ChristianMurphy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2017-12-21T14:32:09.000Z","updated_at":"2022-07-22T03:17:05.000Z","dependencies_parsed_at":"2024-01-13T01:14:46.161Z","dependency_job_id":"3054856c-de3d-43d4-aad3-b117c22ae429","html_url":"https://github.com/ChristianMurphy/selective","commit_stats":{"total_commits":1191,"total_committers":3,"mean_commits":397.0,"dds":0.07976490344248532,"last_synced_commit":"eec308dbef51bf11f951828c6c5772ead0a4237f"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianMurphy%2Fselective","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianMurphy%2Fselective/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianMurphy%2Fselective/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianMurphy%2Fselective/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChristianMurphy","download_url":"https://codeload.github.com/ChristianMurphy/selective/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505906,"owners_count":21115354,"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":["accessibility","css-selector","lint","linter","rehype"],"created_at":"2024-10-01T14:50:01.407Z","updated_at":"2025-04-12T01:43:27.539Z","avatar_url":"https://github.com/ChristianMurphy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Selective](docs/selective.png)\n\n[![NPM Version](https://img.shields.io/npm/v/@selective/rehype.svg)](https://www.npmjs.com/package/@selective/rehype)\n[![Linux Build Status](https://travis-ci.org/ChristianMurphy/selective.svg?branch=master)](https://travis-ci.org/ChristianMurphy/selective)\n[![Windows Build status](https://ci.appveyor.com/api/projects/status/5vcbepc478hkyt2f/branch/master?svg=true)](https://ci.appveyor.com/project/ChristianMurphy/selective/branch/master)\n\n\u003e Use CSS selectors to find HTML anti-patterns\n\n## Creating Rules\n\ncreate a configuration in a _.selective_ file.\n\n`@selective/rehype` will look for a _config.selective_ file in the current folder by default.\n\nThe rules language is designed to work similar to CSS.\nUse a [CSS Selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to find HTML elements.\n\nInstead of the usual style rules, linter rules are used.\n\n- `name` a unique identifier for easily tracking down the rule\n- `description` an explanation of the problem.\n- `recommended` how this will be reported, can be one of:\n  - `error` will stop processing and return an error code\n  - `warn` will continue processing, but highlight as important, no error code.\n  - `info` will continue processing, no error code.\n  - `off` disabled\n\n## Example Rules\n\n```css\nimg:not([alt]) {\n  name: \"img-alt\";\n  description: \"image tag must contain an alt property\";\n  recommended: warn;\n}\n\nimg:not([src]) {\n  name: \"img-src\";\n  description: \"image tag must contain an src property\";\n  recommended: warn;\n}\n\nol \u003e :not(li),\nul \u003e :not(li),\n:not(ol) \u003e li,\n:not(ul) \u003e li {\n  name: \"list-item\";\n  description: \"unorder lists, ordered lists, and list items must have a direction relationship\";\n  recommended: warn;\n}\n```\n\n## Atom Usage\n\n```bash\napm install linter-selective\n```\n\n![selective lint example](docs/selective-lint-example.gif)\n\n[linter-selective](https://github.com/ChristianMurphy/linter-selective)\n\n## Rehype CLI Usage\n\nin _package.json_ through [rehype](https://github.com/rehypejs/rehype).\n\n```json\n{\n  \"devDependencies\": {\n    \"rehype\": \"^5.0.0\",\n    \"@selective/rehype\": \"0.0.3\"\n  },\n  \"rehype\": {\n    \"plugins\": [\"@selective/rehype\"]\n  }\n}\n```\n\nthis can be additionally customized with a custom config file path\n\n```json\n{\n  \"devDependencies\": {\n    \"rehype\": \"^5.0.0\",\n    \"@selective/rehype\": \"0.0.3\"\n  },\n  \"rehype\": {\n    \"plugins\": [[\"@selective/rehype\", { \"config\": \"custom.selective\" }]]\n  }\n}\n```\n\n## Programmatic Usage\n\n\u003c!-- eslint-disable no-console --\u003e\n\n```javascript\nconst rehype = require(\"rehype\");\nconst selectiveRehype = require(\"@selective/rehype\");\nconst { readFileSync } = require(\"fs\");\n\nrehype()\n  .use(\n    selectiveRehype({\n      config: \"config.selective\",\n    })\n  )\n  .process(readFileSync(\"somefile.html\"), (err) =\u003e {\n    console.error(err);\n  });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristianmurphy%2Fselective","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristianmurphy%2Fselective","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristianmurphy%2Fselective/lists"}