detect typo in metadata when linting
makes use of https://github.com/openstyles/usercss-meta/pull/78
This commit is contained in:
parent
404efcecf9
commit
b6cc6a09b9
|
@ -970,6 +970,18 @@
|
|||
},
|
||||
"description": "Error displayed when unknown metadata is parsed"
|
||||
},
|
||||
"meta_unknownMetaTypo": {
|
||||
"message": "Maybe @$keyOk$? Unknown metadata: @$keyErr$",
|
||||
"placeholders": {
|
||||
"keyErr": {
|
||||
"content": "$1"
|
||||
},
|
||||
"keyOk": {
|
||||
"content": "$2"
|
||||
}
|
||||
},
|
||||
"description": "Try translating it so that at least the first placeholder is visible in our narrow panel. This is the error displayed when an unknown metadata key was sufficiently similar to a known one to consider it a typo."
|
||||
},
|
||||
"meta_unknownPreprocessor": {
|
||||
"message": "Unknown @preprocessor: $preprocessor$",
|
||||
"placeholders": {
|
||||
|
|
|
@ -326,13 +326,17 @@ function SourceEditor() {
|
|||
if (errors.every(err => err.code === 'unknownMeta')) {
|
||||
onUpdated(metadata);
|
||||
}
|
||||
cache = errors.map(err => ({
|
||||
from: cm.posFromIndex((err.index || 0) + match.index),
|
||||
to: cm.posFromIndex((err.index || 0) + match.index),
|
||||
message: err.code && t(`meta_${err.code}`, err.args, false) || err.message,
|
||||
severity: err.code === 'unknownMeta' ? 'warning' : 'error',
|
||||
rule: err.code,
|
||||
}));
|
||||
cache = errors.map(({code, index, args, message}) => {
|
||||
const isUnknownMeta = code === 'unknownMeta';
|
||||
const typo = isUnknownMeta && args.length === 2 ? 'Typo' : '';
|
||||
return ({
|
||||
from: cm.posFromIndex((index || 0) + match.index),
|
||||
to: cm.posFromIndex((index || 0) + match.index),
|
||||
message: code && t(`meta_${code}${typo}`, args, false) || message,
|
||||
severity: isUnknownMeta ? 'warning' : 'error',
|
||||
rule: code,
|
||||
});
|
||||
});
|
||||
meta = match[0];
|
||||
metaIndex = match.index;
|
||||
return cache;
|
||||
|
|
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -16,7 +16,7 @@
|
|||
"lz-string-unsafe": "^1.4.4-fork-1",
|
||||
"stylelint-bundle": "^13.8.0",
|
||||
"stylus-lang-bundle": "github:openstyles/stylus-lang-bundle#v0.54.7",
|
||||
"usercss-meta": "^0.11.0",
|
||||
"usercss-meta": "^0.12.0",
|
||||
"webext-launch-web-auth-flow": "^0.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -11125,9 +11125,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/usercss-meta": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/usercss-meta/-/usercss-meta-0.11.0.tgz",
|
||||
"integrity": "sha512-I6yJacP9zxr2Urww7loqJOzHfrrxxelziRiZZn4zKLj2117/MXt6Q4ix7Y1IWm4FrrL4JAo3LPpB4ggHeNWtMw==",
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/usercss-meta/-/usercss-meta-0.12.0.tgz",
|
||||
"integrity": "sha512-zKrXCKdpeIwtVe87omxGo9URf+7mbozduMZEg79dmT4KB3XJwfIkEi/Uk0PcTwR/nZLtAK1+k7isgbGB/g6E7Q==",
|
||||
"engines": {
|
||||
"node": ">=8.3"
|
||||
}
|
||||
|
@ -21126,9 +21126,9 @@
|
|||
"optional": true
|
||||
},
|
||||
"usercss-meta": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/usercss-meta/-/usercss-meta-0.11.0.tgz",
|
||||
"integrity": "sha512-I6yJacP9zxr2Urww7loqJOzHfrrxxelziRiZZn4zKLj2117/MXt6Q4ix7Y1IWm4FrrL4JAo3LPpB4ggHeNWtMw=="
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/usercss-meta/-/usercss-meta-0.12.0.tgz",
|
||||
"integrity": "sha512-zKrXCKdpeIwtVe87omxGo9URf+7mbozduMZEg79dmT4KB3XJwfIkEi/Uk0PcTwR/nZLtAK1+k7isgbGB/g6E7Q=="
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"lz-string-unsafe": "^1.4.4-fork-1",
|
||||
"stylelint-bundle": "^13.8.0",
|
||||
"stylus-lang-bundle": "github:openstyles/stylus-lang-bundle#v0.54.7",
|
||||
"usercss-meta": "^0.11.0",
|
||||
"usercss-meta": "^0.12.0",
|
||||
"webext-launch-web-auth-flow": "^0.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
2
vendor/usercss-meta/README.md
vendored
2
vendor/usercss-meta/README.md
vendored
|
@ -1,4 +1,4 @@
|
|||
## usercss-meta v0.11.0
|
||||
## usercss-meta v0.12.0
|
||||
|
||||
Following files are copied from npm (node_modules):
|
||||
|
||||
|
|
2
vendor/usercss-meta/usercss-meta.min.js
vendored
2
vendor/usercss-meta/usercss-meta.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user