mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Re-enable dot-notation
Warn all 'pretty' users (regardless of attractiveness) that their builds may break.
This commit is contained in:
parent
2abb740153
commit
c8c6505ae8
3 changed files with 9 additions and 6 deletions
|
@ -75,7 +75,7 @@ module.exports = {
|
||||||
"@typescript-eslint/class-name-casing": "off",
|
"@typescript-eslint/class-name-casing": "off",
|
||||||
"@typescript-eslint/consistent-type-assertions": "error",
|
"@typescript-eslint/consistent-type-assertions": "error",
|
||||||
"@typescript-eslint/consistent-type-definitions": "error",
|
"@typescript-eslint/consistent-type-definitions": "error",
|
||||||
"@typescript-eslint/dot-notation": "off", //"error",
|
"@typescript-eslint/dot-notation": "error",
|
||||||
"@typescript-eslint/explicit-member-accessibility": [
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
"off",
|
"off",
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,7 @@ main() {
|
||||||
for file in $stagedFiles; do
|
for file in $stagedFiles; do
|
||||||
if cmp -s <(staged "$file") "$file"; then
|
if cmp -s <(staged "$file") "$file"; then
|
||||||
echo "WARN: Staged copy of '$file' matches working copy. Modifying both"
|
echo "WARN: Staged copy of '$file' matches working copy. Modifying both"
|
||||||
|
echo "WARN: Modifications may break builds: check that your code still builds"
|
||||||
lock .git/index.lock
|
lock .git/index.lock
|
||||||
case "$file" in
|
case "$file" in
|
||||||
*.md | *.css) prettier --write "$file";;
|
*.md | *.css) prettier --write "$file";;
|
||||||
|
@ -45,6 +46,7 @@ main() {
|
||||||
git add "$file"
|
git add "$file"
|
||||||
else
|
else
|
||||||
echo "WARN: Staged copy of '$file' does not match working copy: only prettifying staged copy."
|
echo "WARN: Staged copy of '$file' does not match working copy: only prettifying staged copy."
|
||||||
|
echo "WARN: Modifications may break builds: check that your code still builds"
|
||||||
(
|
(
|
||||||
local tmpdir
|
local tmpdir
|
||||||
tmpdir=$(mktemp -d "pretty.XXXXXXXXX")
|
tmpdir=$(mktemp -d "pretty.XXXXXXXXX")
|
||||||
|
|
|
@ -16,12 +16,13 @@ export function findCssRules(
|
||||||
const rule = x[1]
|
const rule = x[1]
|
||||||
return (
|
return (
|
||||||
rule.type === "rule" &&
|
rule.type === "rule" &&
|
||||||
|
"selectors" in rule &&
|
||||||
// Make sure that there are as many selectors in the current rule
|
// Make sure that there are as many selectors in the current rule
|
||||||
// as there are in the rule we're looking for
|
// as there are in the rule we're looking for
|
||||||
rule["selectors"].length === selectors.length &&
|
rule.selectors.length === selectors.length &&
|
||||||
// Also make sure that each of the selectors of the current rule
|
// Also make sure that each of the selectors of the current rule
|
||||||
// are present in the rule we're looking for
|
// are present in the rule we're looking for
|
||||||
!rule["selectors"].find(selector => !selectors.includes(selector))
|
!rule.selectors.find(selector => !selectors.includes(selector))
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
return filtSheet.map(x => x[0])
|
return filtSheet.map(x => x[0])
|
||||||
|
@ -246,14 +247,14 @@ export function changeSingleCss(
|
||||||
optionname: string,
|
optionname: string,
|
||||||
sheet: CSS.Stylesheet,
|
sheet: CSS.Stylesheet,
|
||||||
): CSS.Stylesheet {
|
): CSS.Stylesheet {
|
||||||
const selector = potentialRules[rulename]["name"]
|
const selector = potentialRules[rulename].name
|
||||||
const newRule = `${selector} {
|
const newRule = `${selector} {
|
||||||
${potentialRules[rulename]["options"][optionname]}
|
${potentialRules[rulename].options[optionname]}
|
||||||
}`
|
}`
|
||||||
const miniSheet = CSS.parse(newRule).stylesheet.rules[0]
|
const miniSheet = CSS.parse(newRule).stylesheet.rules[0]
|
||||||
|
|
||||||
// Find pre-existing rules
|
// Find pre-existing rules
|
||||||
const oldRuleIndexes = findCssRules(miniSheet["selectors"], sheet)
|
const oldRuleIndexes = findCssRules("selectors" in miniSheet ? miniSheet.selectors : [], sheet)
|
||||||
if (oldRuleIndexes.length > 0) {
|
if (oldRuleIndexes.length > 0) {
|
||||||
sheet.stylesheet.rules[oldRuleIndexes[0]] = miniSheet
|
sheet.stylesheet.rules[oldRuleIndexes[0]] = miniSheet
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue