-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(code-style): run prettier (#1705)
- Loading branch information
Showing
14 changed files
with
114 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
module.exports = { | ||
parser: "@typescript-eslint/parser", // Specifies the ESLint parser | ||
parser: '@typescript-eslint/parser', // Specifies the ESLint parser | ||
parserOptions: { | ||
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features | ||
sourceType: "module", // Allows for the use of imports | ||
sourceType: 'module', // Allows for the use of imports | ||
ecmaFeatures: { | ||
jsx: true, // Allows for the parsing of JSX | ||
}, | ||
}, | ||
settings: { | ||
react: { | ||
version: "detect", // Tells eslint-plugin-react to automatically detect the version of React to use | ||
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use | ||
}, | ||
}, | ||
extends: [ | ||
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react | ||
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react | ||
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
// "prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | ||
// "plugin:prettier/recommended", // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | ||
], | ||
rules: { | ||
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"react/prop-types": "off" | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'react/prop-types': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ dist/ | |
ws-messages/ | ||
package-lock.json | ||
package.json | ||
.vscode/ | ||
.vscode/ | ||
src/i18n/locales/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"git": { | ||
"commitMessage": "chore(deploy): release v${version}" | ||
}, | ||
"npm": false | ||
} | ||
"git": { | ||
"commitMessage": "chore(deploy): release v${version}" | ||
}, | ||
"npm": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = { extends: ["@commitlint/config-conventional"] }; | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const path = require("path"); | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
getPath: () => path.join(__dirname, "dist"), | ||
getPath: () => path.join(__dirname, 'dist'), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"config:base" | ||
] | ||
"extends": ["config:base"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
{ | ||
"devices": {}, | ||
"deviceStates": {}, | ||
"touchlinkDevices": [], | ||
"touchlinkScanInProgress": false, | ||
"touchlinkIdentifyInProgress": false, | ||
"touchlinkResetInProgress": false, | ||
"networkGraph": { | ||
"links": [], | ||
"nodes": [] | ||
}, | ||
"networkGraphIsLoading": false, | ||
"groups": [], | ||
"bridgeState": "online", | ||
"bridgeConfig": { | ||
}, | ||
"bridgeInfo": { | ||
"configSchema": { | ||
"properties": {}, | ||
"required": [] | ||
"devices": {}, | ||
"deviceStates": {}, | ||
"touchlinkDevices": [], | ||
"touchlinkScanInProgress": false, | ||
"touchlinkIdentifyInProgress": false, | ||
"touchlinkResetInProgress": false, | ||
"networkGraph": { | ||
"links": [], | ||
"nodes": [] | ||
}, | ||
"config": { | ||
"advanced": {} | ||
} | ||
}, | ||
"logs": [], | ||
"extensions": [], | ||
"theme": "light", | ||
"missingTranslations": {}, | ||
"availability": {}, | ||
"prepearingBackup": false, | ||
"backup": "" | ||
"networkGraphIsLoading": false, | ||
"groups": [], | ||
"bridgeState": "online", | ||
"bridgeConfig": {}, | ||
"bridgeInfo": { | ||
"configSchema": { | ||
"properties": {}, | ||
"required": [] | ||
}, | ||
"config": { | ||
"advanced": {} | ||
} | ||
}, | ||
"logs": [], | ||
"extensions": [], | ||
"theme": "light", | ||
"missingTranslations": {}, | ||
"availability": {}, | ||
"prepearingBackup": false, | ||
"backup": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,45 @@ | ||
|
||
var diff = require('deep-diff') | ||
var diff = require('deep-diff'); | ||
const _ = require('lodash'); | ||
const fs = require('fs') | ||
const fs = require('fs'); | ||
|
||
let isObject = function(a) { | ||
return (!!a) && (a.constructor === Object); | ||
let isObject = function (a) { | ||
return !!a && a.constructor === Object; | ||
}; | ||
function removeEmpty(obj) { | ||
return Object.entries(obj) | ||
.filter(([_, v]) => v != null && v != "") | ||
.reduce( | ||
(acc, [k, v]) => ({ ...acc, [k]: isObject(v) ? removeEmpty(v) : v }), | ||
{} | ||
); | ||
.filter(([_, v]) => v != null && v != '') | ||
.reduce((acc, [k, v]) => ({ ...acc, [k]: isObject(v) ? removeEmpty(v) : v }), {}); | ||
} | ||
|
||
const enTranslationFile = './src/i18n/locales/en.json'; | ||
const enTranslations = require(enTranslationFile); | ||
|
||
|
||
const ignoredFiles = ['localeNames.json', 'en.json']; | ||
const localesDir = './src/i18n/locales' | ||
const localesDir = './src/i18n/locales'; | ||
const files = []; | ||
const dir = fs.opendirSync(localesDir) | ||
let dirent | ||
const dir = fs.opendirSync(localesDir); | ||
let dirent; | ||
while ((dirent = dir.readSync()) !== null) { | ||
if (!ignoredFiles.includes(dirent.name)) { | ||
files.push(dirent.name) | ||
files.push(dirent.name); | ||
} | ||
} | ||
dir.closeSync() | ||
dir.closeSync(); | ||
|
||
for (const file of files) { | ||
const localeFileName = `./src/i18n/locales/${file}`; | ||
const translations = require(localeFileName); | ||
const diffR = diff(enTranslations, translations) | ||
const diffR = diff(enTranslations, translations); | ||
|
||
let newTranslation = {}; | ||
diffR.forEach(d => { | ||
diffR.forEach((d) => { | ||
switch (d.kind) { | ||
case 'E': | ||
_.set(newTranslation, d.path, d.rhs); | ||
break; | ||
} | ||
|
||
}) | ||
}); | ||
newTranslation = removeEmpty(newTranslation); | ||
console.log(`Trimmed ${localeFileName}`) | ||
console.log(`Trimmed ${localeFileName}`); | ||
fs.writeFileSync(localeFileName, JSON.stringify(newTranslation, null, 4)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.