Skip to content

Commit

Permalink
Apply Prettier to the entire project
Browse files Browse the repository at this point in the history
This ensures that our tests will be formatted by Prettier, among other things.
  • Loading branch information
robintown committed Dec 9, 2022
1 parent e6e18dd commit 90ef550
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 80 deletions.
64 changes: 28 additions & 36 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
module.exports = {
plugins: [
"matrix-org",
],
extends: [
plugins: ["matrix-org"],
extends: ["plugin:matrix-org/react", "plugin:matrix-org/a11y", "prettier"],
env: {
browser: true,
node: true,
},
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"jsx-a11y/media-has-caption": ["off"],
},
overrides: [
{
files: ["src/**/*.{ts,tsx}"],
extends: [
"plugin:matrix-org/typescript",
"plugin:matrix-org/react",
"plugin:matrix-org/a11y",
"prettier",
],
env: {
browser: true,
node: true,
],
rules: {
// We're aiming to convert this code to strict mode
"@typescript-eslint/no-non-null-assertion": "off",
},
},
parserOptions: {
"ecmaVersion": "latest",
"sourceType": "module",
},
rules: {
"jsx-a11y/media-has-caption": ["off"],
},
overrides: [
{
files: [
"src/**/*.{ts,tsx}",
],
extends: [
"plugin:matrix-org/typescript",
"plugin:matrix-org/react",
"prettier",
],
rules: {
// We're aiming to convert this code to strict mode
"@typescript-eslint/no-non-null-assertion": "off",
},
},
],
settings: {
react: {
version: "detect",
},
],
settings: {
react: {
version: "detect",
},
},
};
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ body:
id: browser
attributes:
label: Browser information
description: Which browser are you using? Which version?
description: Which browser are you using? Which version?
placeholder: e.g. Chromium Version 92.0.4515.131
validations:
required: false
Expand All @@ -58,10 +58,10 @@ body:
id: rageshake
attributes:
label: Will you send logs?
description: |
description: |
To send them, press the 'Submit Feedback' button and check 'Include Debug Logs'. Please link to this issue in the description field.
options:
- 'Yes'
- 'No'
- "Yes"
- "No"
validations:
required: true
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Yarn cache
uses: actions/setup-node@v3
with:
cache: 'yarn'
cache: "yarn"
- name: Install dependencies
run: "yarn install"
- name: Prettier
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/netlify-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
env: main-branch-cd
ref: ${{ github.event.workflow_run.head_sha }}

- name: 'Download artifact'
- name: "Download artifact"
uses: actions/[email protected]
with:
script: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/triage-incoming.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Move new issues into triage board

on:
issues:
types: [ opened ]
types: [opened]

jobs:
add-to-project:
Expand All @@ -13,13 +13,13 @@ jobs:
with:
headers: '{"GraphQL-Features": "projects_next_graphql"}'
query: |
mutation add_to_project($projectid:ID!,$contentid:ID!) {
addProjectV2ItemById(input: {projectId: $projectid contentId: $contentid}) {
item {
id
}
mutation add_to_project($projectid:ID!,$contentid:ID!) {
addProjectV2ItemById(input: {projectId: $projectid contentId: $contentid}) {
item {
id
}
}
}
projectid: ${{ env.PROJECT_ID }}
contentid: ${{ github.event.issue.node_id }}
env:
Expand Down
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
"editor.tabSize": 2,
"[typescriptreact]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Contributing code to Element
============================
# Contributing code to Element

Element follows the same pattern as the [matrix-js-sdk](https://github.com/matrix-org/matrix-js-sdk/blob/develop/CONTRIBUTING.md).
12 changes: 7 additions & 5 deletions i18next-parser.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ export default {
createOldCatalogs: false,
defaultNamespace: "app",
lexers: {
ts: [{
lexer: "JavascriptLexer",
functions: ["t", "translatedError"],
functionsNamespace: ["useTranslation", "withTranslation"],
}],
ts: [
{
lexer: "JavascriptLexer",
functions: ["t", "translatedError"],
functionsNamespace: ["useTranslation", "withTranslation"],
},
],
},
locales: ["en-GB"],
output: "public/locales/$LOCALE/$NAMESPACE.json",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"serve": "vite preview",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"prettier:check": "prettier -c src",
"prettier:format": "prettier -w src",
"prettier:check": "prettier -c .",
"prettier:format": "prettier -w .",
"lint": "yarn lint:types && yarn lint:js",
"lint:js": "eslint --max-warnings 0 src",
"lint:types": "tsc",
Expand Down
33 changes: 16 additions & 17 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.png" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0"
/>
<title><%- title %></title>
<script>
window.global = window;
</script>
</head>

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>
<%- title %>
</title>
<script>
window.global = window;
</script>
</head>

<body>
<div id="root"></div>
</body>

</html>
<body>
<div id="root"></div>
</body>
</html>
2 changes: 1 addition & 1 deletion test/mocks/olmMock.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { loadOlm: jest.fn(async () => {}) }
module.exports = { loadOlm: jest.fn(async () => {}) };
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
]
},
"include": [
"./src/**/*.ts",
"./src/**/*.ts",
"./src/**/*.tsx",
"./test/**/*.ts",
"./test/**/*.tsx"
Expand Down

0 comments on commit 90ef550

Please sign in to comment.