1. @mapbox/stylelint-processor-arbitrary-tags
A stylelint processor that allows you to lint CSS within arbitrary tags
@mapbox/stylelint-processor-arbitrary-tags
Package: @mapbox/stylelint-processor-arbitrary-tags
Created by: mapbox
Last modified: Tue, 10 Jan 2023 11:03:13 GMT
Version: 0.4.0
License: MIT
Downloads: 43,115
Repository: https://github.com/mapbox/stylelint-processor-arbitrary-tags

Install

npm install @mapbox/stylelint-processor-arbitrary-tags
yarn add @mapbox/stylelint-processor-arbitrary-tags

stylelint-processor-arbitrary-tags

Build Status

A stylelint processor that allows you to lint CSS within arbitrary tags.

The module uses a regular expression to identify code within the specified tags, then passes the code on to stylelint.

By default, it looks for code within <style> tags (see default options below). But you can change the regular expression to find code within other tags, like {% highlight css %}...{% endhighlight %} for Jekyll templates, or /* start css */.../* end css */ within a JS file, or who knows what else.

Install

npm install @mapbox/stylelint-processor-arbitrary-tags

Options

startTag

Type: string that's RegExp-ready

Default:

'[^`\'"]<style[\\s\\S]*?>'

endTag

Type: string that's RegExp-ready

Default:

'</\\s*?style>'

body

Type: string that's RegExp-ready

Default:

'[\\s\\S]*?'

fileFilterRegex

Type: array<RegExp|string> that's an array of regular expressions or strings that describe files that you want to be processed with this module.
Matches will be processed; files that do not match will not be.

Given the following value, only .html files will be processed:

 fileFilterRegex: [/\.html$/]

You can also use regular expression strings instead of regular expression literals. This is necessary if you are using yaml-based configuration and can't use regular expression literals. Yaml variant of example above:

   - fileFilterRegex:
    - '\.html$'

This is useful when you want to create different settings for HTML and markdown, for instance.

When empty ([]), every file will pass through the filter and be processed by this module.

Default:

 []

Caveats

Do not use this processor with the no-empty-source rule. If you do, you will have warnings whenever a file does not contain any matches for your regular expression.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code