Skip to content

Commit

Permalink
Apply prettier for consistent code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mkacmar committed Oct 1, 2024
1 parent 5b9b57b commit 7a5a085
Show file tree
Hide file tree
Showing 70 changed files with 1,240 additions and 1,212 deletions.
24 changes: 13 additions & 11 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/e2e-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
npm i typescript
npm i @microsoft/eslint-formatter-sarif
working-directory: ${{env.TEST_RUN_DIR}}

- uses: actions/checkout@v4
with:
repository: ${{env.GITHUB_REPO}}
Expand All @@ -55,12 +55,12 @@ jobs:
- name: Install plugin dependencies
run: npm install --production
working-directory: ${{env.PLUGIN_DIR}}

- name: Link plugin
run: sudo npm link ../${{env.PLUGIN_DIR}}
working-directory: ${{env.TEST_RUN_DIR}}
if: runner.os == 'Linux'

- name: Link plugin
run: npm link ../${{env.PLUGIN_DIR}}
working-directory: ${{env.TEST_RUN_DIR}}
Expand All @@ -69,18 +69,18 @@ jobs:
- name: Create ESLint config file
run: echo 'module.exports = [...require("@microsoft/eslint-plugin-sdl").configs.recommended];' > eslint.config.js
working-directory: ${{env.TEST_RUN_DIR}}

- name: Run ESLint
run: npx eslint
--config eslint.config.js
--no-config-lookup
${{env.TEST_TARGET_DIR}}/${{env.GITHUB_REPO_ESLINT_GLOB}}
--parser-options=project:${{env.TEST_TARGET_DIR}}/${{env.GITHUB_REPO_TSCONFIG}}
--format @microsoft/eslint-formatter-sarif
--output-file eslint-result-${{ matrix.os }}-${{github.run_id}}.sarif
run: npx eslint
--config eslint.config.js
--no-config-lookup
${{env.TEST_TARGET_DIR}}/${{env.GITHUB_REPO_ESLINT_GLOB}}
--parser-options=project:${{env.TEST_TARGET_DIR}}/${{env.GITHUB_REPO_TSCONFIG}}
--format @microsoft/eslint-formatter-sarif
--output-file eslint-result-${{ matrix.os }}-${{github.run_id}}.sarif
working-directory: ${{env.TEST_RUN_DIR}}
continue-on-error: true
continue-on-error: true

- name: Upload ESLint results as artifact
uses: actions/upload-artifact@v4
with:
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/node-version-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:

jobs:
build:

runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -20,10 +19,10 @@ jobs:
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SECURITY.md
CODE_OF_CONDUCT.md
package.json
package-lock.json
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 100
}
68 changes: 34 additions & 34 deletions README.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions config/angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

"use strict";

// Generates shareable config for modern Angular (https://angular.dev/) apps.
// Generates shareable config for modern Angular (https://angular.dev/) apps.
module.exports = (pluginSdl) => {
return [
{
plugins: {
"@microsoft/sdl": pluginSdl
"@microsoft/sdl": pluginSdl,
},
rules: {
"@microsoft/sdl/no-angular-bypass-sanitizer": "error"
}
}
"@microsoft/sdl/no-angular-bypass-sanitizer": "error",
},
},
];
};
};
12 changes: 6 additions & 6 deletions config/angularjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

"use strict";

// Generates shareable config for legacy AngularJS (https://angularjs.org/) apps.
// Generates shareable config for legacy AngularJS (https://angularjs.org/) apps.
module.exports = (pluginSdl) => {
return [
{
plugins: {
"@microsoft/sdl": pluginSdl
"@microsoft/sdl": pluginSdl,
},
rules: {
"@microsoft/sdl/no-angularjs-enable-svg": "error",
"@microsoft/sdl/no-angularjs-sanitization-whitelist": "error",
"@microsoft/sdl/no-angularjs-bypass-sce": "error"
}
}
"@microsoft/sdl/no-angularjs-bypass-sce": "error",
},
},
];
};
};
10 changes: 5 additions & 5 deletions config/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = (pluginSdl) => {
return [
{
plugins: {
"@microsoft/sdl": pluginSdl
"@microsoft/sdl": pluginSdl,
},
rules: {
"no-caller": "error",
Expand All @@ -23,8 +23,8 @@ module.exports = (pluginSdl) => {
"@microsoft/sdl/no-insecure-url": "error",
"@microsoft/sdl/no-msapp-exec-unsafe": "error",
"@microsoft/sdl/no-postmessage-star-origin": "error",
"@microsoft/sdl/no-winjs-html-unsafe": "error"
}
}
"@microsoft/sdl/no-winjs-html-unsafe": "error",
},
},
];
};
};
10 changes: 5 additions & 5 deletions config/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ module.exports = (pluginSdl) => {
return [
{
plugins: {
"@microsoft/sdl": pluginSdl
"@microsoft/sdl": pluginSdl,
},
rules: {
"@microsoft/sdl/no-electron-node-integration": "error"
}
}
"@microsoft/sdl/no-electron-node-integration": "error",
},
},
];
};
};
14 changes: 7 additions & 7 deletions config/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ module.exports = (pluginSdl) => {
return [
{
plugins: {
n: pluginN
n: pluginN,
},
rules: {
"n/no-deprecated-api": "error"
}
"n/no-deprecated-api": "error",
},
},
{
plugins: {
"@microsoft/sdl": pluginSdl
"@microsoft/sdl": pluginSdl,
},
rules: {
"@microsoft/sdl/no-unsafe-alloc": "error"
}
"@microsoft/sdl/no-unsafe-alloc": "error",
},
},
];
};
};
27 changes: 14 additions & 13 deletions config/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,34 @@ module.exports = (pluginSdl) => {
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true
}
}
}
jsx: true,
},
},
},
},
{
plugins: {
"react": pluginReact
react: pluginReact,
},
rules: {
"react/no-danger": "error",
"react/jsx-no-target-blank": ["error",
"react/jsx-no-target-blank": [
"error",
{
allowReferrer: false,
enforceDynamicLinks: "always",
warnOnSpreadAttributes: true,
}
]
}
},
],
},
},
{
plugins: {
"@microsoft/sdl": pluginSdl,
},
rules: {
"@microsoft/sdl/react-iframe-missing-sandbox": "error"
}
}
"@microsoft/sdl/react-iframe-missing-sandbox": "error",
},
},
];
};
};
20 changes: 10 additions & 10 deletions config/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ module.exports = () => {
ecmaVersion: 6,
sourceType: "module",
ecmaFeatures: {
jsx: true
}
}
}
jsx: true,
},
},
},
},
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parserOptions: {
parser: "@typescript-eslint/parser",
}
},
},
plugins: {
"@typescript-eslint": pluginTypescript
"@typescript-eslint": pluginTypescript,
},
rules: {
"@typescript-eslint/no-implied-eval": "error",
// @typescript-eslint/no-implied-eval offers more accurate results for typescript.
// thus we turn the more generic rule off for ts and tsx files.
// This also avoids duplicate hits.
"no-implied-eval": "off"
}
}
"no-implied-eval": "off",
},
},
];
};
};
2 changes: 1 addition & 1 deletion docs/rules/no-angularjs-bypass-sce.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Calls to `$sceProvider.enabled(false)`, `$sceDelegate.trustAs()`, `$sce.trustAs(

SCE should be bypassed only in very rare and justifiable cases after careful review so that the risk of introducing Cross-Site-Scripting (XSS) vulnerability is minimized.

See [official documentation](https://docs.angularjs.org/api/ng/service/$sce#strict-contextual-escaping) for more details.
See [official documentation](https://docs.angularjs.org/api/ng/service/$sce#strict-contextual-escaping) for more details.
4 changes: 2 additions & 2 deletions docs/rules/no-cookies.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Cookies should be used only in rare and justifiable cases after thorough securit

## Further Reading

* [Using HTTP cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies)
- [Using HTTP cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies)

## Related Rules

* [tslint-microsoft-contrib/no-cookies](https://github.com/microsoft/tslint-microsoft-contrib/blob/master/src/noCookiesRule.ts)
- [tslint-microsoft-contrib/no-cookies](https://github.com/microsoft/tslint-microsoft-contrib/blob/master/src/noCookiesRule.ts)
2 changes: 1 addition & 1 deletion docs/rules/no-document-domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Writes to [`document.domain`](https://developer.mozilla.org/en-US/docs/Web/API/D

## Related Rules

* [tslint-microsoft-contrib/no-document-domain](https://github.com/microsoft/tslint-microsoft-contrib/blob/master/src/noDocumentDomainRule.ts)
- [tslint-microsoft-contrib/no-document-domain](https://github.com/microsoft/tslint-microsoft-contrib/blob/master/src/noDocumentDomainRule.ts)
2 changes: 1 addition & 1 deletion docs/rules/no-document-write.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Calls to document.write or document.writeln manipulate DOM directly without any

## Related Rules

* [tslint-microsoft-contrib/no-document-write](https://github.com/microsoft/tslint-microsoft-contrib/blob/master/src/noDocumentWriteRule.ts)
- [tslint-microsoft-contrib/no-document-write](https://github.com/microsoft/tslint-microsoft-contrib/blob/master/src/noDocumentWriteRule.ts)
2 changes: 1 addition & 1 deletion docs/rules/no-electron-node-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

## Related Rules

* [codeql/js/enabling-electron-renderer-node-integration](https://help.semmle.com/wiki/display/JS/Enabling+Node.js+integration+for+Electron+web+content+renderers)
- [codeql/js/enabling-electron-renderer-node-integration](https://help.semmle.com/wiki/display/JS/Enabling+Node.js+integration+for+Electron+web+content+renderers)
Loading

0 comments on commit 7a5a085

Please sign in to comment.