eslint-plugin-svg 0.0.6 → 0.1.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/README.md +31 -20
- package/dist/index.d.ts +43 -20
- package/dist/index.js +853 -313
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -35,6 +35,9 @@ import pluginSVG from 'eslint-plugin-svg'
|
|
|
35
35
|
export default defineConfig([
|
|
36
36
|
// Other configs...
|
|
37
37
|
...pluginSVG.configs.recommended,
|
|
38
|
+
// Optional extra layers
|
|
39
|
+
...pluginSVG.configs.security,
|
|
40
|
+
...pluginSVG.configs.a11y,
|
|
38
41
|
])
|
|
39
42
|
```
|
|
40
43
|
|
|
@@ -42,29 +45,37 @@ export default defineConfig([
|
|
|
42
45
|
|
|
43
46
|
## Rules
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
✅
|
|
48
|
+
📦 Config presets enabled in.\
|
|
49
|
+
✅ `recommended` preset.\
|
|
50
|
+
🔒 `strict` preset.\
|
|
51
|
+
🛡️ `security` preset.\
|
|
52
|
+
♿ `a11y` preset.\
|
|
47
53
|
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
|
48
54
|
💡 Manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
|
|
49
55
|
|
|
50
|
-
| Name
|
|
51
|
-
|
|
|
52
|
-
| [no-empty-title](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-title)
|
|
53
|
-
| [no-empty-desc](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-desc)
|
|
54
|
-
| [no-empty-text](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-text)
|
|
55
|
-
| [no-empty-container](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-container)
|
|
56
|
-
| [no-empty-groups](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-groups)
|
|
57
|
-
| [no-base64-data-url](https://eslint-plugin-svg.ntnyq.com/rules/no-base64-data-url)
|
|
58
|
-
| [no-inline-styles](https://eslint-plugin-svg.ntnyq.com/rules/no-inline-styles)
|
|
59
|
-
| [no-event-handlers](https://eslint-plugin-svg.ntnyq.com/rules/no-event-handlers)
|
|
60
|
-
| [no-script-tags](https://eslint-plugin-svg.ntnyq.com/rules/no-script-tags)
|
|
61
|
-
| [require-viewbox](https://eslint-plugin-svg.ntnyq.com/rules/require-viewbox)
|
|
62
|
-
| [no-deprecated](https://eslint-plugin-svg.ntnyq.com/rules/no-deprecated)
|
|
63
|
-
| [no-doctype](https://eslint-plugin-svg.ntnyq.com/rules/no-doctype)
|
|
64
|
-
| [no-duplicate-ids](https://eslint-plugin-svg.ntnyq.com/rules/no-duplicate-ids)
|
|
65
|
-
| [no-elements](https://eslint-plugin-svg.ntnyq.com/rules/no-elements)
|
|
66
|
-
| [no-comments](https://eslint-plugin-svg.ntnyq.com/rules/no-comments)
|
|
67
|
-
| [no-invalid-role](https://eslint-plugin-svg.ntnyq.com/rules/no-invalid-role)
|
|
56
|
+
| Name | Description | ✅ | 🔒 | 🛡️ | ♿ | 🔧 | 💡 |
|
|
57
|
+
| :------------------------------------------------------------------------------------------- | :---------------------------------------- | :-: | :-: | :-: | :-: | :-: | :-: |
|
|
58
|
+
| [no-empty-title](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-title) | Disallow empty title element | ✅ | ✅ | | ✅ | | |
|
|
59
|
+
| [no-empty-desc](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-desc) | Disallow empty desc element | ✅ | ✅ | | ✅ | | |
|
|
60
|
+
| [no-empty-text](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-text) | Disallow empty text element | ✅ | ✅ | | ✅ | | |
|
|
61
|
+
| [no-empty-container](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-container) | Disallow empty container element | | ✅ | | | | |
|
|
62
|
+
| [no-empty-groups](https://eslint-plugin-svg.ntnyq.com/rules/no-empty-groups) | Disallow empty g element | | ✅ | | | | |
|
|
63
|
+
| [no-base64-data-url](https://eslint-plugin-svg.ntnyq.com/rules/no-base64-data-url) | Disallow base64 data URLs in attributes | | | ✅ | | | |
|
|
64
|
+
| [no-inline-styles](https://eslint-plugin-svg.ntnyq.com/rules/no-inline-styles) | Disallow inline style attribute | | ✅ | | | | |
|
|
65
|
+
| [no-event-handlers](https://eslint-plugin-svg.ntnyq.com/rules/no-event-handlers) | Disallow inline event handlers | | ✅ | ✅ | | | |
|
|
66
|
+
| [no-script-tags](https://eslint-plugin-svg.ntnyq.com/rules/no-script-tags) | Disallow script elements | ✅ | ✅ | ✅ | | | |
|
|
67
|
+
| [require-viewbox](https://eslint-plugin-svg.ntnyq.com/rules/require-viewbox) | Require viewBox on svg elements | ✅ | ✅ | | | | |
|
|
68
|
+
| [no-deprecated](https://eslint-plugin-svg.ntnyq.com/rules/no-deprecated) | Disallow deprecated elements | ✅ | ✅ | | | | |
|
|
69
|
+
| [no-doctype](https://eslint-plugin-svg.ntnyq.com/rules/no-doctype) | Disallow doctype | ✅ | ✅ | | | ✅ | |
|
|
70
|
+
| [no-duplicate-ids](https://eslint-plugin-svg.ntnyq.com/rules/no-duplicate-ids) | Disallow duplicate id attributes | ✅ | ✅ | | | | |
|
|
71
|
+
| [no-elements](https://eslint-plugin-svg.ntnyq.com/rules/no-elements) | Disallow elements by name | | | | | | |
|
|
72
|
+
| [no-comments](https://eslint-plugin-svg.ntnyq.com/rules/no-comments) | Disallow comments in SVG files | | | | | | |
|
|
73
|
+
| [no-invalid-role](https://eslint-plugin-svg.ntnyq.com/rules/no-invalid-role) | Disallow invalid value of role attribute | ✅ | ✅ | | ✅ | | |
|
|
74
|
+
| [no-discouraged-role](https://eslint-plugin-svg.ntnyq.com/rules/no-discouraged-role) | Disallow discouraged role value in SVG | | | | ✅ | | |
|
|
75
|
+
| [no-unsafe-href](https://eslint-plugin-svg.ntnyq.com/rules/no-unsafe-href) | Disallow unsafe href and xlink:href URLs | | | ✅ | | | |
|
|
76
|
+
| [require-accessible-name](https://eslint-plugin-svg.ntnyq.com/rules/require-accessible-name) | Require an accessible name for key SVGs | | | | ✅ | | |
|
|
77
|
+
| [no-unknown-elements](https://eslint-plugin-svg.ntnyq.com/rules/no-unknown-elements) | Disallow non-standard SVG elements | ✅ | ✅ | | | | |
|
|
78
|
+
| [prefer-current-color](https://eslint-plugin-svg.ntnyq.com/rules/prefer-current-color) | Prefer currentColor over hardcoded colors | | | | | | |
|
|
68
79
|
|
|
69
80
|
## License
|
|
70
81
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
import * as eslint from "eslint";
|
|
1
|
+
import * as _$eslint from "eslint";
|
|
2
2
|
import { Linter } from "eslint";
|
|
3
3
|
|
|
4
4
|
//#region src/rules/index.d.ts
|
|
5
5
|
declare const rules: {
|
|
6
|
-
'no-base64-data-url': eslint.Rule.RuleModule;
|
|
7
|
-
'no-comments': eslint.Rule.RuleModule;
|
|
8
|
-
'no-deprecated': eslint.Rule.RuleModule;
|
|
9
|
-
'no-
|
|
10
|
-
'no-
|
|
11
|
-
'no-
|
|
12
|
-
'no-
|
|
13
|
-
'no-empty-
|
|
14
|
-
'no-empty-
|
|
15
|
-
'no-empty-
|
|
16
|
-
'no-empty-
|
|
17
|
-
'no-
|
|
18
|
-
'no-
|
|
19
|
-
'no-
|
|
20
|
-
'no-
|
|
21
|
-
'
|
|
6
|
+
'no-base64-data-url': _$eslint.Rule.RuleModule;
|
|
7
|
+
'no-comments': _$eslint.Rule.RuleModule;
|
|
8
|
+
'no-deprecated': _$eslint.Rule.RuleModule;
|
|
9
|
+
'no-discouraged-role': _$eslint.Rule.RuleModule;
|
|
10
|
+
'no-doctype': _$eslint.Rule.RuleModule;
|
|
11
|
+
'no-duplicate-ids': _$eslint.Rule.RuleModule;
|
|
12
|
+
'no-elements': _$eslint.Rule.RuleModule;
|
|
13
|
+
'no-empty-container': _$eslint.Rule.RuleModule;
|
|
14
|
+
'no-empty-desc': _$eslint.Rule.RuleModule;
|
|
15
|
+
'no-empty-groups': _$eslint.Rule.RuleModule;
|
|
16
|
+
'no-empty-text': _$eslint.Rule.RuleModule;
|
|
17
|
+
'no-empty-title': _$eslint.Rule.RuleModule;
|
|
18
|
+
'no-event-handlers': _$eslint.Rule.RuleModule;
|
|
19
|
+
'no-inline-styles': _$eslint.Rule.RuleModule;
|
|
20
|
+
'no-invalid-role': _$eslint.Rule.RuleModule;
|
|
21
|
+
'no-script-tags': _$eslint.Rule.RuleModule;
|
|
22
|
+
'no-unknown-elements': _$eslint.Rule.RuleModule;
|
|
23
|
+
'no-unsafe-href': _$eslint.Rule.RuleModule;
|
|
24
|
+
'prefer-current-color': _$eslint.Rule.RuleModule;
|
|
25
|
+
'require-accessible-name': _$eslint.Rule.RuleModule;
|
|
26
|
+
'require-viewbox': _$eslint.Rule.RuleModule;
|
|
22
27
|
};
|
|
23
28
|
//#endregion
|
|
24
29
|
//#region src/types/plugin.d.ts
|
|
25
30
|
interface PluginSVG {
|
|
31
|
+
/** rule implementations exposed by the plugin */
|
|
26
32
|
rules: typeof rules;
|
|
33
|
+
/** named config presets exposed by the plugin */
|
|
27
34
|
configs: {
|
|
28
|
-
|
|
35
|
+
/** accessibility preset */a11y: Linter.Config<Linter.RulesRecord>[]; /** recommended baseline preset */
|
|
36
|
+
recommended: Linter.Config<Linter.RulesRecord>[]; /** security-focused preset */
|
|
37
|
+
security: Linter.Config<Linter.RulesRecord>[]; /** strict preset with additional stylistic checks */
|
|
38
|
+
strict: Linter.Config<Linter.RulesRecord>[];
|
|
29
39
|
};
|
|
40
|
+
/** plugin package metadata */
|
|
30
41
|
meta: {
|
|
31
|
-
name: string;
|
|
42
|
+
/** package name */name: string; /** package version */
|
|
32
43
|
version: string;
|
|
33
44
|
};
|
|
34
45
|
}
|
|
@@ -44,6 +55,18 @@ declare const meta: {
|
|
|
44
55
|
* recommended config preset
|
|
45
56
|
*/
|
|
46
57
|
declare const recommended: Linter.Config<Linter.RulesRecord>[];
|
|
58
|
+
/**
|
|
59
|
+
* strict config preset
|
|
60
|
+
*/
|
|
61
|
+
declare const strict: Linter.Config<Linter.RulesRecord>[];
|
|
62
|
+
/**
|
|
63
|
+
* security config preset
|
|
64
|
+
*/
|
|
65
|
+
declare const security: Linter.Config<Linter.RulesRecord>[];
|
|
66
|
+
/**
|
|
67
|
+
* accessibility config preset
|
|
68
|
+
*/
|
|
69
|
+
declare const a11y: Linter.Config<Linter.RulesRecord>[];
|
|
47
70
|
declare const configs: PluginSVG['configs'];
|
|
48
71
|
//#endregion
|
|
49
72
|
//#region src/index.d.ts
|
|
@@ -55,4 +78,4 @@ declare const configs: PluginSVG['configs'];
|
|
|
55
78
|
*/
|
|
56
79
|
declare const plugin: PluginSVG;
|
|
57
80
|
//#endregion
|
|
58
|
-
export { configs, plugin as default, plugin, meta, recommended, rules };
|
|
81
|
+
export { a11y, configs, plugin as default, plugin, meta, recommended, rules, security, strict };
|