@plumeria/eslint-plugin 11.2.1 → 12.0.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 +2 -2
- package/dist/index.d.ts +3 -7
- package/dist/index.js +2 -23
- package/dist/rules/format-properties.js +1 -4
- package/dist/rules/no-combinator.js +1 -1
- package/dist/rules/no-invalid-selector.js +6 -2
- package/dist/rules/no-unused-keys.js +1 -4
- package/dist/rules/sort-properties.js +1 -4
- package/oxlint-plugin.js +1 -1
- package/oxlint.json +11 -1
- package/package.json +12 -5
package/README.md
CHANGED
|
@@ -21,9 +21,9 @@ The `plugin:@plumeria/recommended` config enables the following:
|
|
|
21
21
|
- `@plumeria/validate-values`: **warn**
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
import
|
|
24
|
+
import plumeria from '@plumeria/eslint-plugin';
|
|
25
25
|
|
|
26
|
-
export default [plumeria.
|
|
26
|
+
export default [plumeria.configs.recommended];
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Rules
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { Linter, Rule } from 'eslint';
|
|
2
|
+
declare const plugin: {
|
|
3
3
|
rules: Record<string, Rule.RuleModule>;
|
|
4
4
|
configs: {
|
|
5
|
-
recommended: Linter.LegacyConfig;
|
|
6
|
-
};
|
|
7
|
-
flatConfigs: {
|
|
8
5
|
recommended: Linter.Config;
|
|
9
6
|
};
|
|
10
7
|
};
|
|
11
|
-
export
|
|
12
|
-
export {};
|
|
8
|
+
export = plugin;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.plumeria = void 0;
|
|
4
2
|
const style_name_requires_import_1 = require("./rules/style-name-requires-import");
|
|
5
3
|
const no_combinator_1 = require("./rules/no-combinator");
|
|
6
4
|
const no_destructure_1 = require("./rules/no-destructure");
|
|
@@ -28,25 +26,6 @@ const rules = {
|
|
|
28
26
|
'validate-values': validate_values_1.validateValues,
|
|
29
27
|
};
|
|
30
28
|
const configs = {
|
|
31
|
-
recommended: {
|
|
32
|
-
plugins: ['@plumeria'],
|
|
33
|
-
rules: {
|
|
34
|
-
'@plumeria/style-name-requires-import': 'error',
|
|
35
|
-
'@plumeria/no-combinator': 'error',
|
|
36
|
-
'@plumeria/no-destructure': 'error',
|
|
37
|
-
'@plumeria/no-inline-object': 'error',
|
|
38
|
-
'@plumeria/no-inner-call': 'error',
|
|
39
|
-
'@plumeria/no-invalid-selector': 'error',
|
|
40
|
-
'@plumeria/no-mixed-styling-props': 'error',
|
|
41
|
-
'@plumeria/no-unknown-css-properties': 'error',
|
|
42
|
-
'@plumeria/no-unused-keys': 'warn',
|
|
43
|
-
'@plumeria/sort-properties': 'warn',
|
|
44
|
-
'@plumeria/format-properties': 'warn',
|
|
45
|
-
'@plumeria/validate-values': 'warn',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
const flatConfigs = {
|
|
50
29
|
recommended: {
|
|
51
30
|
plugins: {
|
|
52
31
|
'@plumeria': {
|
|
@@ -69,8 +48,8 @@ const flatConfigs = {
|
|
|
69
48
|
},
|
|
70
49
|
},
|
|
71
50
|
};
|
|
72
|
-
|
|
51
|
+
const plugin = {
|
|
73
52
|
rules,
|
|
74
53
|
configs,
|
|
75
|
-
flatConfigs,
|
|
76
54
|
};
|
|
55
|
+
module.exports = plugin;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatProperties = void 0;
|
|
4
|
-
function getSourceCode(context) {
|
|
5
|
-
return context.sourceCode ?? context.getSourceCode();
|
|
6
|
-
}
|
|
7
4
|
exports.formatProperties = {
|
|
8
5
|
meta: {
|
|
9
6
|
type: 'layout',
|
|
@@ -19,7 +16,7 @@ exports.formatProperties = {
|
|
|
19
16
|
},
|
|
20
17
|
create(context) {
|
|
21
18
|
const plumeriaAliases = {};
|
|
22
|
-
const sourceCode =
|
|
19
|
+
const sourceCode = context.sourceCode;
|
|
23
20
|
function checkStyleObject(node) {
|
|
24
21
|
if (node.type !== 'ObjectExpression' || node.properties.length === 0)
|
|
25
22
|
return;
|
|
@@ -45,18 +45,22 @@ exports.noInvalidSelector = {
|
|
|
45
45
|
return 'QUERY';
|
|
46
46
|
if (type.value.startsWith(':'))
|
|
47
47
|
return 'PSEUDO';
|
|
48
|
+
return 'PROPERTY';
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
catch (error) {
|
|
51
52
|
}
|
|
53
|
+
return 'UNKNOWN';
|
|
52
54
|
}
|
|
53
|
-
return '
|
|
55
|
+
return 'SKIP';
|
|
54
56
|
}
|
|
55
57
|
function checkNesting(node, parentType) {
|
|
56
58
|
for (const prop of node.properties) {
|
|
57
59
|
if (prop.type !== utils_1.TSESTree.AST_NODE_TYPES.Property)
|
|
58
60
|
continue;
|
|
59
61
|
const currentType = getSelectorType(prop.key);
|
|
62
|
+
if (currentType === 'SKIP')
|
|
63
|
+
continue;
|
|
60
64
|
if (currentType === 'UNKNOWN') {
|
|
61
65
|
context.report({
|
|
62
66
|
node: prop.key,
|
|
@@ -205,7 +209,7 @@ exports.noInvalidSelector = {
|
|
|
205
209
|
styleObj.properties.forEach((prop) => {
|
|
206
210
|
if (prop.type === utils_1.TSESTree.AST_NODE_TYPES.Property) {
|
|
207
211
|
const currentType = getSelectorType(prop.key);
|
|
208
|
-
if (currentType === 'UNKNOWN') {
|
|
212
|
+
if (currentType !== 'SKIP' && currentType === 'UNKNOWN') {
|
|
209
213
|
context.report({
|
|
210
214
|
node: prop.key,
|
|
211
215
|
messageId: 'invalidKeySelector',
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.noUnusedKeys = void 0;
|
|
4
|
-
function getFilename(context) {
|
|
5
|
-
return context.getFilename ? context.getFilename() : context.filename;
|
|
6
|
-
}
|
|
7
4
|
function getRootObject(node) {
|
|
8
5
|
if (node.type === 'Identifier') {
|
|
9
6
|
return node;
|
|
@@ -25,7 +22,7 @@ exports.noUnusedKeys = {
|
|
|
25
22
|
schema: [],
|
|
26
23
|
},
|
|
27
24
|
create(context) {
|
|
28
|
-
const filename =
|
|
25
|
+
const filename = context.filename;
|
|
29
26
|
if (filename.endsWith('.ts')) {
|
|
30
27
|
return {};
|
|
31
28
|
}
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sortProperties = void 0;
|
|
4
4
|
const propertyGroups_1 = require("../util/propertyGroups");
|
|
5
|
-
function getSourceCode(context) {
|
|
6
|
-
return context.getSourceCode ? context.getSourceCode() : context.sourceCode;
|
|
7
|
-
}
|
|
8
5
|
function getPropertyName(property) {
|
|
9
6
|
if (property.key.type === 'Identifier') {
|
|
10
7
|
return property.key.name;
|
|
@@ -88,7 +85,7 @@ exports.sortProperties = {
|
|
|
88
85
|
create(context) {
|
|
89
86
|
const plumeriaAliases = {};
|
|
90
87
|
function checkStyleObject(node) {
|
|
91
|
-
const sourceCode =
|
|
88
|
+
const sourceCode = context.sourceCode;
|
|
92
89
|
const properties = node.properties.filter((prop) => ('key' in prop && !!prop.key) || prop.type === 'SpreadElement');
|
|
93
90
|
const chunks = [];
|
|
94
91
|
let currentChunk = [];
|
package/oxlint-plugin.js
CHANGED
package/oxlint.json
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"jsPlugins": [
|
|
2
|
+
"jsPlugins": [
|
|
3
|
+
{
|
|
4
|
+
"name": "@plumeria",
|
|
5
|
+
"specifier": "@plumeria/eslint-plugin/oxlint-plugin"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
3
8
|
"plugins": [],
|
|
4
9
|
"ignorePatterns": ["**/*.svelte", "**/*.vue"],
|
|
5
10
|
|
|
6
11
|
"rules": {
|
|
12
|
+
"@plumeria/style-name-requires-import": "error",
|
|
7
13
|
"@plumeria/no-combinator": "error",
|
|
8
14
|
"@plumeria/no-destructure": "error",
|
|
15
|
+
"@plumeria/no-inline-object": "error",
|
|
9
16
|
"@plumeria/no-inner-call": "error",
|
|
17
|
+
"@plumeria/no-invalid-selector": "error",
|
|
18
|
+
"@plumeria/no-mixed-styling-props": "error",
|
|
19
|
+
"@plumeria/no-unknown-css-properties": "error",
|
|
10
20
|
"@plumeria/no-unused-keys": "warn",
|
|
11
21
|
"@plumeria/sort-properties": "warn",
|
|
12
22
|
"@plumeria/format-properties": "warn",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/eslint-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Plumeria ESLint plugin",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,6 +25,13 @@
|
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"main": "dist/index.js",
|
|
27
27
|
"types": "dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./oxlint-plugin": "./oxlint-plugin.js"
|
|
34
|
+
},
|
|
28
35
|
"files": [
|
|
29
36
|
"dist/",
|
|
30
37
|
"oxlint-plugin.js",
|
|
@@ -35,16 +42,16 @@
|
|
|
35
42
|
},
|
|
36
43
|
"devDependencies": {
|
|
37
44
|
"@types/eslint": "^9.6.1",
|
|
38
|
-
"@types/estree": "^1.0.
|
|
39
|
-
"@typescript-eslint/parser": "^8.59.
|
|
40
|
-
"eslint": "^
|
|
45
|
+
"@types/estree": "^1.0.9",
|
|
46
|
+
"@typescript-eslint/parser": "^8.59.3",
|
|
47
|
+
"eslint": "^10.4.0"
|
|
41
48
|
},
|
|
42
49
|
"publishConfig": {
|
|
43
50
|
"access": "public",
|
|
44
51
|
"provenance": true
|
|
45
52
|
},
|
|
46
53
|
"dependencies": {
|
|
47
|
-
"@typescript-eslint/utils": "^8.59.
|
|
54
|
+
"@typescript-eslint/utils": "^8.59.3",
|
|
48
55
|
"known-css-properties": "^0.37.0"
|
|
49
56
|
},
|
|
50
57
|
"scripts": {
|