Skip to content

Commit

Permalink
edit: enable forced, consistent formatting
Browse files Browse the repository at this point in the history
* Added esbenp.prettier-vscode extension as a recommended plugin
* Updated to eslint instead of tslint
* Turned on format document on save
* Added .editorconfig for formatting options
  • Loading branch information
duckdoom4 committed Apr 29, 2022
1 parent 9148299 commit c648c60
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 30 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
max_line_length = 240
trim_trailing_whitespace = true
indent_style = space

# 4 space indentation
[*.{ts,py}]
indent_size = 4

# 2 space indentation
[*.json]
indent_size = 2
72 changes: 72 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config
It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.
We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
Happy linting! 💖
*/
module.exports = {
"env": {
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
],
"rules": {
"@typescript-eslint/member-delimiter-style": [
"warn",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/semi": [
"warn",
"always"
],
"curly": "warn",
"eqeqeq": [
"warn",
"always"
],
"no-redeclare": "warn",
"no-throw-literal": "warn",
"no-unused-expressions": "warn",
"semi": "warn",
"import/no-unresolved": [
"error",
{
"ignore": ["vscode"]
}
],
},
"ignorePatterns": [
".eslintrc.js",
]
};
8 changes: 3 additions & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"eg2.tslint"
]
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
29 changes: 22 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"**/*.rpyc": true
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"cmake.configureOnOpen": true
"files.exclude": {
"**/*.rpyc": true
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"cmake.configureOnOpen": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,

"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
37 changes: 21 additions & 16 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
"script": "lint",
"problemMatcher": ["$eslint-stylish"]
}
]
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,17 @@
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"test": "npm run compile && node ./node_modules/vscode/bin/test"
"test": "npm run compile && node ./node_modules/vscode/bin/test",
"lint": "eslint -c .eslintrc.js --ext .ts ./src/"
},
"devDependencies": {
"@types/vscode": "^1.50.0",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.23",
"tslint": "^6.1.1",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"eslint": "^8.11.0",
"eslint-plugin-import": "^2.25.4",
"typescript": "^4.6.3",
"vscode-test": "^1.6.1"
}
Expand Down

0 comments on commit c648c60

Please sign in to comment.