Skip to content

Commit

Permalink
[ST3] Enable for JSX, TSX (React) syntaxes (#35)
Browse files Browse the repository at this point in the history
Also, add sublime-package schema and use dotted settings.
  • Loading branch information
rchl authored Oct 2, 2020
1 parent 1c4d1c3 commit 2cd98d2
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 16 deletions.
40 changes: 25 additions & 15 deletions LSP-eslint.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,45 @@
"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",
],
},
],
"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
},
},
},
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
156 changes: 156 additions & 0 deletions sublime-package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
}
}
}
},
]
}
}

0 comments on commit 2cd98d2

Please sign in to comment.