-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: format web base code consistently (#1460)
## Problem For whatever reason, the code web frontend code does not have a consistent format. ## Solution _Prettify_ the code by running `npx prettier . -w` after adapting the configuration we had in `.prettierrc` and updating the list of directories/files it should ignore via `.prettierignore` file. What we have decided it to use as much defaults as possible, ending up with just one override: `printWidth`. Having lines up to 100 characters length looks a good compromise for us in terms of code readability. To make the change possible, conflicts between ESLint and Prettier has been solved by making use of https://github.com/prettier/eslint-config-prettier. Something similar with Stylelint, for which https://github.com/prettier/stylelint-prettier has been used.
- Loading branch information
Showing
246 changed files
with
4,975 additions
and
4,543 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,14 +1,17 @@ | ||
{ | ||
"presets": [ | ||
["@babel/env", { | ||
"targets": { | ||
"chrome": "57", | ||
"firefox": "52", | ||
"safari": "10.3", | ||
"edge": "16", | ||
"opera": "44" | ||
} | ||
}], | ||
"@babel/preset-react" | ||
] | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"targets": { | ||
"chrome": "57", | ||
"firefox": "52", | ||
"safari": "10.3", | ||
"edge": "16", | ||
"opera": "44" | ||
} | ||
} | ||
], | ||
"@babel/preset-react" | ||
] | ||
} |
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,83 +1,94 @@ | ||
{ | ||
"root": true, | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
"jest": true | ||
"root": true, | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
"jest": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"standard", | ||
"standard-jsx", | ||
"standard-react", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 7, | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"standard", | ||
"standard-jsx", | ||
"standard-react", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 7, | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["agama-i18n", "flowtype", "i18next", "react", "react-hooks", "@typescript-eslint"], | ||
"rules": { | ||
"agama-i18n/string-literals": "error", | ||
"i18next/no-literal-string": "error", | ||
"indent": ["error", 2, | ||
{ | ||
"ObjectExpression": "first", | ||
"CallExpression": {"arguments": "first"}, | ||
"MemberExpression": 1, | ||
"ignoredNodes": [ "JSXAttribute" ], | ||
"SwitchCase": 1 | ||
}], | ||
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 2 }], | ||
"no-var": "error", | ||
"no-multi-str": "off", | ||
"no-use-before-define": "off", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/no-use-before-define": "warn", | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }], | ||
"prefer-promise-reject-errors": ["error", { "allowEmptyReject": true }], | ||
"react/jsx-indent": ["error", 2], | ||
"semi": ["error", "always", { "omitLastInOneLineBlock": true }], | ||
|
||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "error", | ||
|
||
"camelcase": "off", | ||
"comma-dangle": "off", | ||
"curly": "off", | ||
"jsx-quotes": "off", | ||
"key-spacing": "off", | ||
"no-console": "off", | ||
"quotes": "off", | ||
"react/jsx-curly-spacing": "off", | ||
"react/jsx-indent-props": "off", | ||
"react/prop-types": "off", | ||
"space-before-function-paren": "off", | ||
"n/no-callback-literal": "off" | ||
}, | ||
"overrides": [ | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"agama-i18n", | ||
"flowtype", | ||
"i18next", | ||
"react", | ||
"react-hooks", | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"agama-i18n/string-literals": "error", | ||
"i18next/no-literal-string": "error", | ||
"no-var": "error", | ||
"no-multi-str": "off", | ||
"no-use-before-define": "off", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/no-use-before-define": "warn", | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
"lines-between-class-members": [ | ||
"error", | ||
"always", | ||
{ | ||
// do not check translations in the testing or development files | ||
"files": ["*.test.*", "test-utils.js"], | ||
"rules": { | ||
"i18next/no-literal-string": "off" | ||
} | ||
}, | ||
"exceptAfterSingleLine": true | ||
} | ||
], | ||
"prefer-promise-reject-errors": [ | ||
"error", | ||
{ | ||
// do not check translation arguments in the test, it checks some internals by passing variables | ||
"files": ["i18n.test.js"], | ||
"rules": { | ||
"agama-i18n/string-literals": "off" | ||
} | ||
"allowEmptyReject": true | ||
} | ||
], | ||
"globals": { | ||
"require": false, | ||
"module": false | ||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "error", | ||
"camelcase": "off", | ||
"comma-dangle": "off", | ||
"curly": "off", | ||
"jsx-quotes": "off", | ||
"key-spacing": "off", | ||
"no-console": "off", | ||
"quotes": "off", | ||
"react/jsx-curly-spacing": "off", | ||
"react/jsx-indent-props": "off", | ||
"react/prop-types": "off", | ||
"space-before-function-paren": "off", | ||
"n/no-callback-literal": "off" | ||
}, | ||
"overrides": [ | ||
{ | ||
// do not check translations in the testing or development files | ||
"files": [ | ||
"*.test.*", | ||
"test-utils.js" | ||
], | ||
"rules": { | ||
"i18next/no-literal-string": "off" | ||
} | ||
}, | ||
{ | ||
// do not check translation arguments in the test, it checks some internals by passing variables | ||
"files": [ | ||
"i18n.test.js" | ||
], | ||
"rules": { | ||
"agama-i18n/string-literals": "off" | ||
} | ||
} | ||
], | ||
"globals": { | ||
"require": false, | ||
"module": 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,5 @@ | ||
src/lib/cockpit.js | ||
dist | ||
po | ||
public | ||
share | ||
src/lib |
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,7 +1,3 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"printWidth": 100, | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "none" | ||
"printWidth": 100 | ||
} |
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
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,16 +1,13 @@ | ||
const { NODE_ENV } = process.env; | ||
|
||
const presets = [ | ||
'@babel/preset-react', | ||
['@babel/preset-env', { targets: { node: 'current' } }] | ||
]; | ||
const presets = ["@babel/preset-react", ["@babel/preset-env", { targets: { node: "current" } }]]; | ||
const plugins = []; | ||
|
||
if (!['production', 'test'].includes(NODE_ENV)) { | ||
plugins.push('react-refresh/babel'); | ||
if (!["production", "test"].includes(NODE_ENV)) { | ||
plugins.push("react-refresh/babel"); | ||
} | ||
|
||
module.exports = { | ||
presets, | ||
plugins | ||
plugins, | ||
}; |
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.