@double-great/stylelint-a11y 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,56 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.4.0] - 2025-08-17
9
+
10
+ ### Added
11
+
12
+ - Strict configuration (`@double-great/stylelint-a11y/strict`) that enables all accessibility rules
13
+ - CONTRIBUTING.md with comprehensive guide for adding new rules
14
+ - Severity levels documentation showing how to configure rules as errors or warnings
15
+ - Basic configuration examples in README
16
+ - Inline rule disabling documentation
17
+ - Badges for npm version and MIT license
18
+ - Links to test directories in Testing Infrastructure section
19
+ - Test coverage for strict configuration
20
+
21
+ ### Changed
22
+
23
+ - Enhanced README with better organization and more comprehensive documentation
24
+ - Updated Testing Infrastructure section with links instead of bold text
25
+
26
+ ### Fixed
27
+
28
+ - Corrected `plugin` to `plugins` in recommended.js configuration
29
+
30
+ ## [3.3.0] - 2025-08-17
31
+
32
+ ### Added
33
+
34
+ - Advanced testing infrastructure with comprehensive CI/CD workflows
35
+ - System-level performance regression testing suite
36
+ - Cross-platform compatibility testing for Node.js environments
37
+ - Integration tests for real-world stylelint plugin functionality
38
+ - Enhanced rule configuration options with customizable parameters
39
+ - Meta objects for all rules with documentation URLs and fixable status
40
+ - Comprehensive rule documentation with examples and configuration options
41
+
42
+ ### Changed
43
+
44
+ - Enhanced stylelint standards compliance with proper meta objects across all rules
45
+ - Standardized rule message formatting for consistent error reporting
46
+ - Improved Jest configuration with proper Node.js module support
47
+ - Updated all rule implementations to follow modern stylelint plugin patterns
48
+ - Enhanced rule functionality with configurable options for better customization
49
+ - Improved error messages for better developer experience
50
+
51
+ ### Fixed
52
+
53
+ - Removed deprecated experimental VM modules flag from Jest scripts for Node.js compatibility
54
+ - Resolved CI performance test expectations for consistent build environments
55
+ - Cleaned up test infrastructure and removed redundant configuration files
56
+ - Fixed rule message clarity and consistency across all accessibility rules
57
+
8
58
  ## [3.2.0] - 2025-08-16
9
59
 
10
60
  ### Added
@@ -0,0 +1,164 @@
1
+ # Contributing to stylelint-a11y
2
+
3
+ Thank you for your interest in contributing to stylelint-a11y! This guide will help you get started with contributing to the project.
4
+
5
+ ## Getting Started
6
+
7
+ 1. Fork the repository
8
+ 2. Clone your fork locally
9
+ 3. Install dependencies with `npm install`
10
+ 4. Create a new branch for your feature or fix
11
+ 5. Make your changes
12
+ 6. Run tests with `npm test`
13
+ 7. Submit a pull request
14
+
15
+ ## Adding a New Rule
16
+
17
+ When adding a new accessibility rule to this plugin, please follow this checklist:
18
+
19
+ ### Rule Implementation Checklist
20
+
21
+ - [ ] **Create rule directory structure**
22
+ - [ ] Create new directory under `src/rules/[rule-name]/`
23
+ - [ ] Rule name should be kebab-case and descriptive
24
+
25
+ - [ ] **Implement the rule** (`src/rules/[rule-name]/index.js`)
26
+ - [ ] Export a function that follows stylelint's rule API
27
+ - [ ] Include proper rule metadata (ruleName, messages)
28
+ - [ ] Implement the rule logic
29
+ - [ ] Use stylelint's built-in utilities where appropriate
30
+ - [ ] Handle edge cases and nested selectors
31
+
32
+ - [ ] **Write comprehensive tests** (`src/rules/[rule-name]/__tests__/index.js`)
33
+ - [ ] Test valid cases (code that should pass)
34
+ - [ ] Test invalid cases (code that should fail)
35
+ - [ ] Test edge cases and complex selectors
36
+ - [ ] Test with SCSS syntax if applicable
37
+ - [ ] Test auto-fix functionality if the rule is fixable
38
+ - [ ] Ensure good test coverage
39
+
40
+ - [ ] **Create rule documentation** (`src/rules/[rule-name]/README.md`)
41
+ - [ ] Provide clear description of what the rule does
42
+ - [ ] Explain why this accessibility rule is important
43
+ - [ ] Include links to WCAG guidelines or other authoritative sources
44
+ - [ ] Show examples of violations
45
+ - [ ] Show examples of valid code
46
+ - [ ] Document any options the rule accepts
47
+ - [ ] Note if the rule is auto-fixable
48
+
49
+ - [ ] **Register the rule**
50
+ - [ ] Add the rule to `src/rules/index.js`
51
+ - [ ] Export it from the main rules index
52
+
53
+ - [ ] **Update plugin configuration**
54
+ - [ ] Add the rule to `src/index.js` in the rules export
55
+ - [ ] Consider if it should be in `recommended.js` config
56
+
57
+ - [ ] **Update main README**
58
+ - [ ] Add the rule to the rules table in `README.md`
59
+ - [ ] Include description and any badges (Recommended, Fixable)
60
+ - [ ] Keep alphabetical order
61
+
62
+ - [ ] **Test the rule thoroughly**
63
+ - [ ] Run unit tests: `npm run test:unit`
64
+ - [ ] Run integration tests: `npm run test:integration`
65
+ - [ ] Run all tests: `npm test`
66
+ - [ ] Ensure no performance regressions: `npm run test:performance`
67
+
68
+ - [ ] **Code quality checks**
69
+ - [ ] Run linting: `npm run lint`
70
+ - [ ] Check formatting: `npm run format:check`
71
+ - [ ] Fix formatting if needed: `npm run format:fix`
72
+
73
+ - [ ] **Manual testing**
74
+ - [ ] Test the rule in a real project
75
+ - [ ] Verify error messages are clear and helpful
76
+ - [ ] Check that line numbers are accurate
77
+ - [ ] Test with different stylelint configurations
78
+
79
+ ### Example Rule Structure
80
+
81
+ Here's what a typical rule implementation looks like:
82
+
83
+ ```javascript
84
+ // src/rules/my-new-rule/index.js
85
+ import stylelint from 'stylelint';
86
+
87
+ const ruleName = 'a11y/my-new-rule';
88
+ const messages = stylelint.utils.ruleMessages(ruleName, {
89
+ expected: 'Expected ...',
90
+ });
91
+
92
+ const meta = {
93
+ url: 'https://github.com/double-great/stylelint-a11y/tree/main/src/rules/my-new-rule',
94
+ };
95
+
96
+ const ruleFunction = (primaryOption, secondaryOptions) => {
97
+ return (root, result) => {
98
+ // Rule implementation
99
+ };
100
+ };
101
+
102
+ ruleFunction.ruleName = ruleName;
103
+ ruleFunction.messages = messages;
104
+ ruleFunction.meta = meta;
105
+
106
+ export default ruleFunction;
107
+ ```
108
+
109
+ ## Code Style
110
+
111
+ - Use ES6+ features
112
+ - Follow the existing code style (enforced by ESLint and Prettier)
113
+ - Write clear, self-documenting code
114
+ - Add JSDoc comments for complex functions
115
+
116
+ ## Testing
117
+
118
+ We maintain high test coverage. Please ensure your changes include appropriate tests:
119
+
120
+ - Unit tests for individual rules
121
+ - Integration tests for plugin functionality
122
+ - E2E tests for real-world scenarios
123
+ - Performance tests for efficiency
124
+
125
+ Run the test suite with:
126
+
127
+ ```bash
128
+ npm test # Run all tests
129
+ npm run test:unit # Run unit tests only
130
+ npm run coverage # Run tests with coverage report
131
+ ```
132
+
133
+ ## Commit Messages
134
+
135
+ - Use clear, descriptive commit messages
136
+ - Follow conventional commit format when possible
137
+ - Reference issue numbers when applicable
138
+
139
+ ## Pull Request Process
140
+
141
+ 1. Ensure all tests pass
142
+ 2. Update documentation as needed
143
+ 3. Add a description of your changes
144
+ 4. Link any related issues
145
+ 5. Wait for code review
146
+ 6. Address any feedback
147
+
148
+ ## Reporting Issues
149
+
150
+ When reporting issues, please include:
151
+
152
+ - Stylelint version
153
+ - Plugin version
154
+ - Node.js version
155
+ - Minimal reproduction case
156
+ - Expected vs actual behavior
157
+
158
+ ## Questions?
159
+
160
+ Feel free to open an issue for any questions about contributing.
161
+
162
+ ## License
163
+
164
+ By contributing, you agree that your contributions will be licensed under the MIT License.
package/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # @double-great/stylelint-a11y
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@double-great/stylelint-a11y.svg)](https://www.npmjs.com/package/@double-great/stylelint-a11y)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Stylelint plugin for CSS accessibility rules.
7
+
3
8
  ## Installation and usage
4
9
 
5
10
  This plugin requires Stylelint 16.0.0 or higher.
@@ -12,6 +17,44 @@ Create the `.stylelintrc.json` config file (or open the existing one), add `styl
12
17
 
13
18
  Please refer to [stylelint docs](https://stylelint.io/user-guide/) for the detailed info on using this linter.
14
19
 
20
+ ## Basic Configuration
21
+
22
+ Here's a basic `.stylelintrc.json` configuration:
23
+
24
+ ```json
25
+ {
26
+ "plugins": ["@double-great/stylelint-a11y"],
27
+ "rules": {
28
+ "a11y/no-outline-none": true,
29
+ "a11y/font-size-is-readable": true,
30
+ "a11y/media-prefers-reduced-motion": true,
31
+ "a11y/selector-pseudo-class-focus": true
32
+ }
33
+ }
34
+ ```
35
+
36
+ Or extend one of the provided configs:
37
+
38
+ ```json
39
+ {
40
+ "extends": ["@double-great/stylelint-a11y/recommended"],
41
+ "rules": {
42
+ // Add any additional rules or overrides here
43
+ }
44
+ }
45
+ ```
46
+
47
+ For stricter accessibility checks:
48
+
49
+ ```json
50
+ {
51
+ "extends": ["@double-great/stylelint-a11y/strict"],
52
+ "rules": {
53
+ // Override any rules if needed
54
+ }
55
+ }
56
+ ```
57
+
15
58
  ## Rules
16
59
 
17
60
  | Rule ID | Description | |
@@ -29,7 +72,9 @@ Please refer to [stylelint docs](https://stylelint.io/user-guide/) for the detai
29
72
  | [no-text-align-justify](./src/rules/no-text-align-justify/README.md) | Disallow content with `text-align: justify` | |
30
73
  | [selector-pseudo-class-focus](./src/rules/selector-pseudo-class-focus/README.md) | Require or disallow a pseudo-element to the selectors with `:hover` | Recommended, Fixable |
31
74
 
32
- ## Recommended config
75
+ ## Configurations
76
+
77
+ ### Recommended config
33
78
 
34
79
  Add recommended configuration by adding the following to `extends` in your stylelint configuration:
35
80
 
@@ -50,7 +95,119 @@ This shareable config contains the following:
50
95
  }
51
96
  ```
52
97
 
53
- Since it adds stylelint-a11y to `plugins`, you don't have to do this yourself when extending this config.
98
+ ### Strict config
99
+
100
+ For a more comprehensive accessibility check, use the strict configuration:
101
+
102
+ ```
103
+ @double-great/stylelint-a11y/strict
104
+ ```
105
+
106
+ This config enables ALL accessibility rules:
107
+
108
+ ```json
109
+ {
110
+ "plugins": ["@double-great/stylelint-a11y"],
111
+ "rules": {
112
+ "a11y/content-property-no-static-value": true,
113
+ "a11y/font-size-is-readable": true,
114
+ "a11y/line-height-is-vertical-rhythmed": true,
115
+ "a11y/media-prefers-color-scheme": true,
116
+ "a11y/media-prefers-reduced-motion": true,
117
+ "a11y/no-display-none": true,
118
+ "a11y/no-obsolete-attribute": true,
119
+ "a11y/no-obsolete-element": true,
120
+ "a11y/no-outline-none": true,
121
+ "a11y/no-spread-text": true,
122
+ "a11y/no-text-align-justify": true,
123
+ "a11y/selector-pseudo-class-focus": true
124
+ }
125
+ }
126
+ ```
127
+
128
+ Since both configs add stylelint-a11y to `plugins`, you don't have to do this yourself when extending these configs.
129
+
130
+ ## Rule Configuration
131
+
132
+ ### Severity Levels
133
+
134
+ Stylelint supports configuring rules with different severity levels. You can set rules to either "error" or "warning":
135
+
136
+ ```json
137
+ {
138
+ "rules": {
139
+ "a11y/no-outline-none": "error",
140
+ "a11y/font-size-is-readable": "warning",
141
+ "a11y/media-prefers-reduced-motion": ["warning", { "ignore": ["animation"] }]
142
+ }
143
+ }
144
+ ```
145
+
146
+ You can also use array syntax with severity as the first element:
147
+
148
+ ```json
149
+ {
150
+ "rules": {
151
+ "a11y/no-outline-none": ["error"],
152
+ "a11y/font-size-is-readable": ["warning", { "thresholdInPixels": 14 }],
153
+ "a11y/selector-pseudo-class-focus": ["error", "always"]
154
+ }
155
+ }
156
+ ```
157
+
158
+ - **"error"** - The rule will report an error (exit code 2 when running stylelint)
159
+ - **"warning"** - The rule will report a warning (exit code 0 unless there are errors)
160
+
161
+ ### Rule Options
162
+
163
+ Many rules support additional configuration options for customization. For example:
164
+
165
+ ```json
166
+ {
167
+ "rules": {
168
+ "a11y/font-size-is-readable": [true, { "thresholdInPixels": 16 }],
169
+ "a11y/no-spread-text": [true, { "minWidth": 30, "maxWidth": 60 }],
170
+ "a11y/line-height-is-vertical-rhythmed": [true, { "baselineGrid": 20 }]
171
+ }
172
+ }
173
+ ```
174
+
175
+ Refer to individual rule documentation for available options.
176
+
177
+ ## Disabling Rules
178
+
179
+ You can disable rules inline using stylelint's comment syntax:
180
+
181
+ ```css
182
+ /* stylelint-disable a11y/no-outline-none */
183
+ .button:focus {
184
+ outline: none;
185
+ }
186
+ /* stylelint-enable a11y/no-outline-none */
187
+ ```
188
+
189
+ Or for a single line:
190
+
191
+ ```css
192
+ .button:focus {
193
+ outline: none; /* stylelint-disable-line a11y/no-outline-none */
194
+ }
195
+ ```
196
+
197
+ ## Contributing
198
+
199
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for detailed information on:
200
+
201
+ - How to add new rules
202
+ - Code style guidelines
203
+ - Testing requirements
204
+ - Pull request process
205
+
206
+ For quick links:
207
+
208
+ - [Issue reporting](https://github.com/double-great/stylelint-a11y/issues)
209
+ - [Pull requests](https://github.com/double-great/stylelint-a11y/pulls)
210
+ - [Changelog](https://github.com/double-great/stylelint-a11y/blob/main/CHANGELOG.md)
54
211
 
55
212
  ## Development
56
213
 
@@ -69,10 +226,10 @@ Run tests with the following commands:
69
226
 
70
227
  This project includes testing at a few levels:
71
228
 
72
- - **Unit tests** - Individual rule functionality
73
- - **Integration tests** - Plugin integration with stylelint
74
- - **E2E tests** - Real-world project testing with intentional violations
75
- - **Performance tests** - Benchmark testing for large codebases
229
+ - [Unit tests](./src/rules) - Individual rule functionality
230
+ - [Integration tests](./test/integration) - Plugin integration with stylelint
231
+ - [E2E tests](./test/e2e) - Real-world project testing with intentional violations
232
+ - [Performance tests](./test/e2e/performance.test.js) - Benchmark testing for large codebases
76
233
 
77
234
  ### Other Commands
78
235
 
@@ -80,3 +237,7 @@ This project includes testing at a few levels:
80
237
  - `npm run format:check` - Check code formatting
81
238
  - `npm run format:fix` - Fix code formatting
82
239
  - `npm run coverage` - Run tests with coverage report
240
+
241
+ ## License
242
+
243
+ This project is licensed under the [MIT License](LICENSE).
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@double-great/stylelint-a11y",
3
- "version": "3.2.0",
3
+ "version": "3.4.0",
4
4
  "description": "Plugin for stylelint with a11y rules",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
9
- "./recommended": "./recommended.js"
9
+ "./recommended": "./recommended.js",
10
+ "./strict": "./strict.js"
10
11
  },
11
12
  "repository": {
12
13
  "type": "git",
@@ -28,14 +29,18 @@
28
29
  "pretest": "npm run lint && npm run format:check",
29
30
  "format:check": "prettier --check .",
30
31
  "format:fix": "prettier --write .",
31
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
32
- "test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js src",
33
- "test:integration": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/integration",
34
- "test:e2e": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/e2e",
35
- "test:performance": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/e2e/performance.test.js",
36
- "test:all": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
37
- "coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
38
- "coverage:all": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage"
32
+ "test": "jest",
33
+ "test:unit": "jest src",
34
+ "test:integration": "jest test/integration",
35
+ "test:e2e": "jest test/e2e",
36
+ "test:performance": "jest test/e2e/performance.test.js",
37
+ "test:system": "jest test/system",
38
+ "test:regression": "jest test/system/performance-regression.test.js",
39
+ "test:compatibility": "jest test/system/compatibility.test.js",
40
+ "test:ci": "jest test/system/ci-integration.test.js",
41
+ "test:all": "jest",
42
+ "coverage": "jest --coverage",
43
+ "coverage:all": "jest --coverage"
39
44
  },
40
45
  "prettier": {
41
46
  "printWidth": 100,
package/recommended.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /** @type {import('stylelint').Config} */
2
2
 
3
3
  export default {
4
- plugin: ['.'],
4
+ plugins: ['.'],
5
5
 
6
6
  rules: {
7
7
  'a11y/media-prefers-reduced-motion': true,
package/src/index.js CHANGED
@@ -3,8 +3,42 @@ const { createPlugin } = stylelint;
3
3
 
4
4
  import rules from './rules/index.js';
5
5
 
6
+ // Import meta objects
7
+ import { meta as contentPropertyMeta } from './rules/content-property-no-static-value/index.js';
8
+ import { meta as fontSizeReadableMeta } from './rules/font-size-is-readable/index.js';
9
+ import { meta as lineHeightRhythmedMeta } from './rules/line-height-is-vertical-rhythmed/index.js';
10
+ import { meta as mediaPrefersColorSchemeMeta } from './rules/media-prefers-color-scheme/index.js';
11
+ import { meta as mediaPrefersReducedMotionMeta } from './rules/media-prefers-reduced-motion/index.js';
12
+ import { meta as noDisplayNoneMeta } from './rules/no-display-none/index.js';
13
+ import { meta as noObsoleteAttributeMeta } from './rules/no-obsolete-attribute/index.js';
14
+ import { meta as noObsoleteElementMeta } from './rules/no-obsolete-element/index.js';
15
+ import { meta as noOutlineNoneMeta } from './rules/no-outline-none/index.js';
16
+ import { meta as noSpreadTextMeta } from './rules/no-spread-text/index.js';
17
+ import { meta as noTextAlignJustifyMeta } from './rules/no-text-align-justify/index.js';
18
+ import { meta as selectorPseudoClassFocusMeta } from './rules/selector-pseudo-class-focus/index.js';
19
+
20
+ const ruleMetaMap = {
21
+ 'content-property-no-static-value': contentPropertyMeta,
22
+ 'font-size-is-readable': fontSizeReadableMeta,
23
+ 'line-height-is-vertical-rhythmed': lineHeightRhythmedMeta,
24
+ 'media-prefers-color-scheme': mediaPrefersColorSchemeMeta,
25
+ 'media-prefers-reduced-motion': mediaPrefersReducedMotionMeta,
26
+ 'no-display-none': noDisplayNoneMeta,
27
+ 'no-obsolete-attribute': noObsoleteAttributeMeta,
28
+ 'no-obsolete-element': noObsoleteElementMeta,
29
+ 'no-outline-none': noOutlineNoneMeta,
30
+ 'no-spread-text': noSpreadTextMeta,
31
+ 'no-text-align-justify': noTextAlignJustifyMeta,
32
+ 'selector-pseudo-class-focus': selectorPseudoClassFocusMeta,
33
+ };
34
+
6
35
  const rulesPlugins = Object.keys(rules).map((ruleName) => {
7
- return createPlugin(`a11y/${ruleName}`, rules[ruleName]);
36
+ const plugin = createPlugin(`a11y/${ruleName}`, rules[ruleName]);
37
+
38
+ // Add meta object to the plugin
39
+ plugin.meta = ruleMetaMap[ruleName];
40
+
41
+ return plugin;
8
42
  });
9
43
 
10
44
  export default rulesPlugins;
@@ -11,6 +11,26 @@ Disallow CSS generated content except aria-label attribute content and empty str
11
11
 
12
12
  ### true
13
13
 
14
+ The rule is enabled with default allowed values: `['""', "''", 'attr(aria-label)']`.
15
+
16
+ ### { allowedValues: string[] }
17
+
18
+ - `allowedValues` (default: `['""', "''", 'attr(aria-label)']`): Array of allowed content values
19
+
20
+ #### Example configuration
21
+
22
+ ```javascript
23
+ {
24
+ "a11y/content-property-no-static-value": [true, {
25
+ "allowedValues": ["''", '""', "attr(title)", "counter(section)"]
26
+ }]
27
+ }
28
+ ```
29
+
30
+ ### Examples
31
+
32
+ #### ✓ Default configuration (`true`)
33
+
14
34
  The following pattern is considered a violation:
15
35
 
16
36
  ```css
@@ -7,9 +7,15 @@ const {
7
7
  export const ruleName = 'a11y/content-property-no-static-value';
8
8
 
9
9
  export const messages = ruleMessages(ruleName, {
10
- expected: (selector) => `Unexpected using "content" property in ${selector}`,
10
+ expected: (selector) => `Expected "content" property to not be used in ${selector}`,
11
11
  });
12
12
 
13
+ export const meta = {
14
+ url: 'https://github.com/double-great/stylelint-a11y/blob/main/src/rules/content-property-no-static-value/README.md',
15
+ fixable: false,
16
+ deprecated: false,
17
+ };
18
+
13
19
  const isContentPropertyUsedCorrectly = (selectors) =>
14
20
  selectors.every((selector) => {
15
21
  return /:before|:after/.test(selector);
@@ -18,24 +24,24 @@ const isContentPropertyUsedCorrectly = (selectors) =>
18
24
  const checkNodesForContentProperty = (node) =>
19
25
  node.nodes.filter((n) => n.prop).some((n) => n.prop.toLowerCase() === 'content');
20
26
 
21
- function check(node) {
27
+ function check(node, options = {}) {
22
28
  if (node.type !== 'rule' || !checkNodesForContentProperty(node) || !node.first) {
23
29
  return true;
24
30
  }
25
31
 
32
+ const allowedValues = options.allowedValues || ["''", '""', 'attr(aria-label)'];
33
+
26
34
  return node.nodes.some((o) => {
27
35
  return (
28
36
  o.type === 'decl' &&
29
37
  o.prop.toLowerCase() === 'content' &&
30
38
  isContentPropertyUsedCorrectly(o.parent.selectors) &&
31
- (o.value.toLowerCase() === "''" ||
32
- o.value.toLowerCase() === '""' ||
33
- o.value.toLowerCase() === 'attr(aria-label)')
39
+ allowedValues.some((allowed) => o.value.toLowerCase() === allowed.toLowerCase())
34
40
  );
35
41
  });
36
42
  }
37
43
 
38
- export default function contentPropertyNoStaticValue(actual) {
44
+ export default function contentPropertyNoStaticValue(actual, options) {
39
45
  return (root, result) => {
40
46
  const validOptions = validateOptions(result, ruleName, { actual });
41
47
 
@@ -60,7 +66,7 @@ export default function contentPropertyNoStaticValue(actual) {
60
66
  return;
61
67
  }
62
68
 
63
- const isAccepted = check(node);
69
+ const isAccepted = check(node, options);
64
70
 
65
71
  if (!isAccepted) {
66
72
  report({
@@ -10,6 +10,12 @@ export const messages = ruleMessages(ruleName, {
10
10
  expected: (selector) => `Expected a larger font-size in ${selector}`,
11
11
  });
12
12
 
13
+ export const meta = {
14
+ url: 'https://github.com/double-great/stylelint-a11y/blob/main/src/rules/font-size-is-readable/README.md',
15
+ fixable: false,
16
+ deprecated: false,
17
+ };
18
+
13
19
  const pxToPt = (v) => 0.75 * v;
14
20
 
15
21
  const checkInPx = (value, THRESHOLD_IN_PX) =>
@@ -10,6 +10,25 @@ Disallow not vertical rhythmed line-height.
10
10
 
11
11
  ### true
12
12
 
13
+ The rule is enabled with default values (24px baseline grid, 1.5 minimum relative line-height).
14
+
15
+ ### { baselineGrid: number, minRelativeLineHeight: number }
16
+
17
+ - `baselineGrid` (default: `24`): Baseline grid value in pixels for pixel-based line-heights
18
+ - `minRelativeLineHeight` (default: `1.5`): Minimum allowed relative line-height value
19
+
20
+ #### Example configuration
21
+
22
+ ```javascript
23
+ {
24
+ "a11y/line-height-is-vertical-rhythmed": [true, { "baselineGrid": 20, "minRelativeLineHeight": 1.3 }]
25
+ }
26
+ ```
27
+
28
+ ### Examples
29
+
30
+ #### ✓ Default configuration (`true`)
31
+
13
32
  The following pattern is considered a violation:
14
33
 
15
34
  ```css