mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-05 19:41:12 +08:00
This also adds CC-BY-4.0 to the list of accepted licenses. DISABLE_THIRD_PARTY_CHECK=update dependencies Bug: chromium:1083142 Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org>
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
// @ts-nocheck
|
|
|
|
'use strict';
|
|
|
|
const declarationValueIndex = require('../utils/declarationValueIndex');
|
|
const isStandardSyntaxDeclaration = require('../utils/isStandardSyntaxDeclaration');
|
|
const report = require('../utils/report');
|
|
|
|
module.exports = function (opts) {
|
|
opts.root.walkDecls((decl) => {
|
|
if (!isStandardSyntaxDeclaration(decl)) {
|
|
return;
|
|
}
|
|
|
|
// Get the raw prop, and only the prop
|
|
const endOfPropIndex = declarationValueIndex(decl) + (decl.raws.between || '').length - 1;
|
|
|
|
// The extra characters tacked onto the end ensure that there is a character to check
|
|
// after the colon. Otherwise, with `background:pink` the character after the
|
|
const propPlusColon = `${decl.toString().slice(0, endOfPropIndex)}xxx`;
|
|
|
|
for (let i = 0, l = propPlusColon.length; i < l; i++) {
|
|
if (propPlusColon[i] !== ':') {
|
|
continue;
|
|
}
|
|
|
|
opts.locationChecker({
|
|
source: propPlusColon,
|
|
index: i,
|
|
lineCheckStr: decl.value,
|
|
err: (m) => {
|
|
if (opts.fix && opts.fix(decl, i)) {
|
|
return;
|
|
}
|
|
|
|
report({
|
|
message: m,
|
|
node: decl,
|
|
index: decl.prop.toString().length + 1,
|
|
result: opts.result,
|
|
ruleName: opts.checkedRuleName,
|
|
});
|
|
},
|
|
});
|
|
break;
|
|
}
|
|
});
|
|
};
|