Skip to content
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 44 additions & 30 deletions editors/code/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,52 @@
// @ts-check

/** @type { import('eslint').Linter.Config } */
module.exports = {
"env": {
"es6": true,
"node": true
env: {
es6: true,
node: true,
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
"plugins": [
"@typescript-eslint"
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We intentionally don't use recommended: #3041

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use it, but the irrelevant rules are explicitly turned off down bellow.

'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'prettier',
'prettier/@typescript-eslint',
],
"rules": {
"camelcase": ["error"],
"eqeqeq": ["error", "always", { "null": "ignore" }],
"no-console": ["error"],
"prefer-const": "error",
"@typescript-eslint/member-delimiter-style": [
"error",
rules: {
camelcase: 'error',
eqeqeq: ['error', 'always', { null: 'ignore' }],
'no-console': 'error',
'prefer-const': 'error',
'@typescript-eslint/explicit-function-return-type': ['warn', { allowExpressions: true }],
'@typescript-eslint/member-delimiter-style': [
'error',
{
"multiline": {
"delimiter": "semi",
"requireLast": true
multiline: {
delimiter: 'semi',
requireLast: true,
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/semi": [
"error",
"always"
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
"@typescript-eslint/no-unnecessary-type-assertion": "error"
}
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/semi': ['error', 'always'],
},
};
1 change: 1 addition & 0 deletions editors/code/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out
21 changes: 21 additions & 0 deletions editors/code/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// @ts-check

/** @type { import('prettier').Options } */
module.exports = {
bracketSpacing: true,
jsxBracketSameLine: true,
printWidth: 100,
semi: true,
singleQuote: true,
tabWidth: 4,
trailingComma: 'all',
useTabs: false,
overrides: [
{
files: '*.ts',
options: {
parser: 'typescript',
},
},
],
};
119 changes: 55 additions & 64 deletions editors/code/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
"vscode:prepublish": "tsc && rollup -c",
"package": "vsce package -o rust-analyzer.vsix",
"watch": "tsc --watch",
"lint": "tsfmt --verify && eslint -c .eslintrc.js --ext ts ./src",
"fix": " tsfmt -r && eslint -c .eslintrc.js --ext ts ./src --fix"
"lint": "eslint 'src/**/*.{js,ts}'",
"fix": " eslint --fix 'src/**/*.{js,ts,tsx}'",
"format": "prettier --write '**/*.{js,json,ts,tsx,yml,yaml}'"
},
"dependencies": {
"jsonc-parser": "^2.2.1",
Expand All @@ -39,16 +40,19 @@
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@rollup/plugin-typescript": "^4.0.0",
"@types/node": "^12.12.30",
"@types/node-fetch": "^2.5.5",
"@types/vscode": "^1.43.0",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"@typescript-eslint/parser": "^2.24.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-prettier": "^3.1.2",
"prettier": "^1.19.1",
"rollup": "^2.1.0",
"tslib": "^1.11.1",
"typescript": "^3.8.3",
"typescript-formatter": "^7.2.2",
"vsce": "^1.74.0"
},
"activationEvents": [
Expand Down
20 changes: 14 additions & 6 deletions editors/code/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,27 @@ export default {
input: 'out/main.js',
plugins: [
resolve({
preferBuiltins: true
preferBuiltins: true,
}),
commonjs({
namedExports: {
// squelch missing import warnings
'vscode-languageclient': ['CreateFile', 'RenameFile', 'ErrorCodes', 'WorkDoneProgress', 'WorkDoneProgressBegin', 'WorkDoneProgressReport', 'WorkDoneProgressEnd']
}
})
'vscode-languageclient': [
'CreateFile',
'RenameFile',
'ErrorCodes',
'WorkDoneProgress',
'WorkDoneProgressBegin',
'WorkDoneProgressReport',
'WorkDoneProgressEnd',
],
},
}),
],
external: [...nodeBuiltins, 'vscode'],
output: {
file: './out/main.js',
format: 'cjs',
exports: 'named'
}
exports: 'named',
},
};
Loading