Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to eslint + prettier #5870

Merged
merged 14 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
63 changes: 63 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
module.exports = {
env: {
node: true
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
plugins: [
"@typescript-eslint",
"unicorn",
"header",
"prettier"
],
root: true,
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/semi": ["error", "always"],
// Allow unused vars if prefixed by _
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/promise-function-async": "error",
"curly": "error",
"prettier/prettier": [ "error", { "endOfLine": "auto" } ],
"unicorn/filename-case": [
"error",
{
"case": "camelCase",
"ignore": [
"I[A-Z].*\\.ts$",
"vscode-tasks\\.d\\.ts"
]
}
],
"header/header": [ 2, "block", [
"---------------------------------------------------------------------------------------------",
" * Copyright (c) Microsoft Corporation. All rights reserved.",
" * Licensed under the MIT License. See License.txt in the project root for license information.",
" *--------------------------------------------------------------------------------------------"
]]
},
ignorePatterns: [
"out/",
"dist/",
"wallaby.js",
"webpack.config.js",
".eslintrc.js",
"**/*.d.ts"
],
};
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
out
dist
6 changes: 5 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"singleQuote": true
"trailingComma": "es5",
JoeRobich marked this conversation as resolved.
Show resolved Hide resolved
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"endOfLine":"auto"
}
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"vsix/": true
},
"csharp.suppressDotnetRestoreNotification": true,
"tslint.rulesDirectory": "node_modules/tslint-microsoft-contrib",
"typescript.tsdk": "./node_modules/typescript/lib",
"mocha.enabled": true,
"omnisharp.autoStart": false,
"editor.formatOnSave": false
"editor.formatOnSave": false,
"eslint.lintTask.enable": true
}
23 changes: 0 additions & 23 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,5 @@
"Run tests in VS Code by launching the debugger with the 'Launch Tests' configuration."
]
},
{
"label": "tslint",
"command": "gulp",
"type": "shell",
"args": [
"tslint"
],
"problemMatcher": {
"owner": "tslint",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"severity": "warning",
"pattern": {
"regexp": "^\\[tslint\\] (.*):(\\d+):(\\d+):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
}
}
]
}
1 change: 0 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ ISSUE_TEMPLATE
package-lock.json
package.json
tsconfig.json
tslint.json
version.json
wallaby.js
webpack.config.js
Expand Down
8 changes: 4 additions & 4 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
*--------------------------------------------------------------------------------------------*/

import * as gulp from 'gulp';
import * as optionsSchemaGenerator from './src/tools/GenerateOptionsSchema';
import * as packageDependencyUpdater from './src/tools/UpdatePackageDependencies';
import * as optionsSchemaGenerator from './src/tools/generateOptionsSchema';
import * as packageDependencyUpdater from './src/tools/updatePackageDependencies';

require('./tasks/testTasks');
require('./tasks/offlinePackagingTasks');
require('./tasks/backcompatTasks');

// Disable warning about wanting an async function
// tslint:disable-next-line
gulp.task('generateOptionsSchema', (): Promise<void> => {
gulp.task('generateOptionsSchema', async (): Promise<void> => {
optionsSchemaGenerator.GenerateOptionsSchema();
return Promise.resolve();
});

// Disable warning about wanting an async function
// tslint:disable-next-line
gulp.task('updatePackageDependencies', (): Promise<void> => {
gulp.task('updatePackageDependencies', async (): Promise<void> => {
return packageDependencyUpdater.updatePackageDependencies();
});
Loading