diff --git a/LSP-eslint.sublime-settings b/LSP-eslint.sublime-settings index b0243cd..9128687 100644 --- a/LSP-eslint.sublime-settings +++ b/LSP-eslint.sublime-settings @@ -2,11 +2,12 @@ "languages": [ { "languageId": "eslint", - "scopes": ["source.js", "text.html.vue"], + "scopes": ["source.js", "source.jsx", "source.js.react", "source.ts", "source.tsx", "text.html.vue"], "syntaxes": [ "Packages/Babel/JavaScript (Babel).sublime-syntax", "Packages/JavaScript/JavaScript.sublime-syntax", - "Packages/JavaScript/JavaScript.sublime-syntax", + "Packages/TypeScript Syntax/TypeScript.tmLanguage", + "Packages/TypeScript Syntax/TypeScriptReact.tmLanguage", "Packages/User/JS Custom/Syntaxes/React.sublime-syntax", "Packages/Vue Syntax Highlight/Vue Component.sublime-syntax", ], @@ -14,23 +15,32 @@ ], "initializationOptions": {}, "settings": { - "validate": true, - "packageManager": "npm", + "codeAction.disableRuleComment": { + // Show the disable code actions. + "enable": true, + // Configure the disable rule code action to insert the comment on the `sameLine` or `separateLine`. + "location": "separateLine" + }, + "codeAction.showDocumentation": { + // Show the documentation code actions. + "enable": true + }, "autoFix": true, "autoFixOnSave": true, - "options": {}, - "run": "onType", + // A path added to NODE_PATH when resolving the eslint module (auto-detected by default). "nodePath": null, + // The eslint options object to provide args normally passed to eslint when + // executed from a command line (see https://eslint.org/docs/developer-guide/nodejs-api#cliengine). + "options": {}, + // The package manager you use to install node modules. + // Possible values: `npm`, `yarn`, `pnpm` + "packageManager": "npm", + // Turns on quiet mode, which ignores warnings. "quiet": false, + // Run the linter on save or on type. + // Possible values: `onSave`, `onType` + "run": "onType", + "validate": true, "workspaceFolder": null, - "codeAction": { - "disableRuleComment": { - "enable": true, - "location": "separateLine" - }, - "showDocumentation": { - "enable": true - }, - }, }, } diff --git a/README.md b/README.md index 3c1fc28..ea02f93 100644 --- a/README.md +++ b/README.md @@ -31,4 +31,4 @@ ESLint configuration options. Those are currently not documented but [documentat Q: How to enable linting of Typescript code? -A: Add `"source.ts"` entry to `scopes` option and `"Packages/TypeScript Syntax/TypeScript.tmLanguage"` entry to `syntaxes` option. It's also necessary to have appropriate ESLint configuration in your project. See https://github.com/typescript-eslint/typescript-eslint for more information. +A: Make sure that eslint configuration in your project has `typescript-eslint` plugin configured. See typescript-eslint/typescript-eslint for more information. diff --git a/sublime-package.json b/sublime-package.json new file mode 100644 index 0000000..0fb71b9 --- /dev/null +++ b/sublime-package.json @@ -0,0 +1,156 @@ +{ + "contributions": { + "settings": [ + { + "file_patterns": [ + "/LSP-eslint.sublime-settings" + ], + "schema": { + "$id": "sublime://settings/LSP-eslint", + "definitions": { + "PluginConfig": { + "properties": { + "env": { + "properties": { + "DEBUG": { + "type": "string", + "default": "", + "description": "Enables ESLint debug mode (same as --debug on the command line)" + }, + "NODE_ENV": { + "type": "string", + "default": "", + "description": "The value of NODE_ENV to use when running eslint tasks." + }, + } + }, + "settings": { + "additionalProperties": false, + "properties": { + "autoFix": { + "type": "boolean", + "default": true, + }, + "autoFixOnSave": { + "type": "boolean", + "default": true, + }, + "packageManager": { + "type": "string", + "enum": [ + "npm", + "yarn", + "pnpm" + ], + "default": "npm", + "description": "The package manager you use to install node modules." + }, + "nodePath": { + "type": [ + "string", + "null" + ], + "default": null, + "description": "A path added to NODE_PATH when resolving the eslint module." + }, + "options": { + "type": "object", + "default": {}, + "markdownDescription": "The eslint options object to provide args normally passed to eslint when executed from a command line (see http://eslint.org/docs/developer-guide/nodejs-api#cliengine)." + }, + "run": { + "type": "string", + "enum": [ + "onSave", + "onType" + ], + "default": "onType", + "markdownDescription": "Run the linter on save (`onSave`) or on type (`onType`)" + }, + "quiet": { + "type": "boolean", + "default": false, + "description": "Turns on quiet mode, which ignores warnings." + }, + "validate": { + "type": "boolean", + "description": "Whether validation is enabled." + }, + "codeAction.disableRuleComment": { + "type": "object", + "default": { + "enable": true, + "location": "separateLine" + }, + "properties": { + "enable": { + "type": "boolean", + "default": true, + "description": "Show the disable code actions." + }, + "location": { + "type": "string", + "enum": [ + "separateLine", + "sameLine" + ], + "default": "separateLine", + "description": "Configure the disable rule code action to insert the comment on the same line or a new line." + } + } + }, + "codeAction.showDocumentation": { + "type": "object", + "default": { + "enable": true + }, + "properties": { + "enable": { + "type": "boolean", + "default": true, + "description": "Show the documentation code actions." + } + } + }, + "workspaceFolder": { + "type": ["string", "null"], + "default": null + } + } + } + }, + }, + }, + "allOf": [ + { + "$ref": "sublime://settings/LSP-plugin-base" + }, + { + "$ref": "sublime://settings/LSP-eslint#/definitions/PluginConfig" + } + ], + } + }, + { + "file_patterns": [ + "/*.sublime-project" + ], + "schema": { + "properties": { + "settings": { + "properties": { + "LSP": { + "properties": { + "LSP-eslint": { + "$ref": "sublime://settings/LSP-eslint#/definitions/PluginConfig" + } + } + } + } + } + } + } + }, + ] + } +}