All Projects → Moxio → stylelint-selector-tag-no-without-class

Moxio / stylelint-selector-tag-no-without-class

Licence: MIT license
Stylelint plugin to disallow certain tags without a class qualifier in selectors

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to stylelint-selector-tag-no-without-class

stylelint-no-indistinguishable-colors
Stylelint plugin to add rule no-indistinguishable-colors
Stars: ✭ 15 (-21.05%)
Mutual labels:  stylelint, stylelint-plugin
stylelint-z-index-value-constraint
Stylelint rule for setting minimum and maximum constraint value for z-index.
Stars: ✭ 18 (-5.26%)
Mutual labels:  stylelint
promotion-web
基于React: v18.x.x/Webpack: v5.x.x/React Router v6.x.x/ Antd: v5..x.x/Fetch Api/ Typescript: v4.x.x 等最新版本进行构建...
Stars: ✭ 374 (+1868.42%)
Mutual labels:  stylelint
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-26.32%)
Mutual labels:  stylelint
cra-template-quickstart-redux
Opinionated quickstart Create React App template with Redux, React Testing Library and custom eslint configuration
Stars: ✭ 66 (+247.37%)
Mutual labels:  stylelint
website-template
静的Webサイト制作を少しモダンにするためのテンプレート
Stars: ✭ 62 (+226.32%)
Mutual labels:  stylelint
vscode-linter
Extension for code linting, all in one package. New linters can be easily added through an extension framework.
Stars: ✭ 47 (+147.37%)
Mutual labels:  stylelint
bowman
A simple static site generator with an integrated toolchain for efficient development and delivery.
Stars: ✭ 17 (-10.53%)
Mutual labels:  stylelint
sonar-css-plugin
SonarQube CSS / SCSS / Less Analyzer
Stars: ✭ 46 (+142.11%)
Mutual labels:  stylelint
nerv-webpack-boilerplate
A webpack boilerplate with Nervjs
Stars: ✭ 52 (+173.68%)
Mutual labels:  stylelint
stylelint-config
Sharable stylelint config used by GitHub's CSS
Stars: ✭ 194 (+921.05%)
Mutual labels:  stylelint
eslint-config-stylelint
Stylelint org's shareable config for eslint
Stars: ✭ 45 (+136.84%)
Mutual labels:  stylelint
EditorConfig-Action
🔎A GitHub Action to check, enforce & fix EditorConfig style violations
Stars: ✭ 40 (+110.53%)
Mutual labels:  stylelint
stencil-boilerplate
A Stencil app boilerplate including routing, Redux etc.
Stars: ✭ 51 (+168.42%)
Mutual labels:  stylelint
fe-standard-config-seed
前端通用代码规范自动化接入
Stars: ✭ 18 (-5.26%)
Mutual labels:  stylelint
ultimate-hot-boilerplate
🚀 node-react universal app boilerplate with everything on hot reload, SSR, GraphQL, Flow included
Stars: ✭ 35 (+84.21%)
Mutual labels:  stylelint
stylelint-scss
A collection of SCSS specific linting rules for Stylelint
Stars: ✭ 812 (+4173.68%)
Mutual labels:  stylelint
static-webpack-boilerplate
🚀 Minimal & Modern Webpack Boilerplate for building static sites
Stars: ✭ 40 (+110.53%)
Mutual labels:  stylelint
linter-sniffer-pretty-printer
Collection of packages and configs to lint and format code in your WordPress project.
Stars: ✭ 35 (+84.21%)
Mutual labels:  stylelint
vue3-vite-ts
Vue 3 Scaffolding (Vite + TS + Linters + Jest + TailwindCSS)
Stars: ✭ 27 (+42.11%)
Mutual labels:  stylelint

Build Status NPM version

stylelint-selector-tag-no-without-class

A stylelint plugin to disallow certain tags without a class qualifier in selectors.

For example, if this rule is configured for (only) the <div> tag, the following patterns are considered violations:

div {}
.foo div {}
div .foo {}
div, .bar {}
div:hover {}

The following patterns are not considered violations:

div.foo {}  /* (tag is qualified with a class) */
a {}        /* (rule not configured for '<a>' tag) */

Rationale

According to the HTML specification, tags like <div> and <span> do no inherently represent anything. It would therefore be strange to attach styling to such a generic container, even within a given context. We believe that tags like <div> and <span> should only have meaning (and thus receive corresponding style rules) when they have a class as an additional qualifier.

Installation

Install this package as a development dependency using NPM:

npm install --save-dev stylelint-selector-tag-no-without-class

Usage

Add the plugin and the corresponding rule to the stylelint configuration file, and configure the tags that should not be used as a selector without a qualifying classname:

// .stylelintrc
{
  "plugins": [
    "stylelint-selector-tag-no-without-class"
  ],
  "rules": {
    "plugin/selector-tag-no-without-class": ["div", "span"]
  }
}

Primary option

array|string: ["array", "of", "tags", "or", "/regexes/"]|"tag"|"/regex/"

Specification of tags that should not occur without a class qualifier. If a string is surrounded with "/", it is interpreted as a regular expression. For example, "^/h\d+$/" disallows using any section heading without a class qualifier.

Versioning

This project adheres to Semantic Versioning. A list of notable changes for each release can be found in the changelog.

License

This plugin is released under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].