Home >Development Tools >sublime >Implement code detection in sublime
The following column sublime usage tutorial will introduce to you how to implement code detection in sublime. I hope it will be helpful to friends in need!
Configure linter, eslint in sublime
sublime plug-in installation
Open pci, install sublimeLinter
Enter and configure the path:
● Configure the basic location of the node:/usr/local/bin/node, /usr/local/bin
● The basic location for configuring node_modules: /usr/local/lib/node_modules
● The location for configuring other plug-ins: such as eslint: /usr/local/bin/eslint
Example The code is as follows:
"paths": { "linux": [], "osx": [ "/usr/local/bin/node", "/usr/local/lib/node_modules", "/usr/local/bin/eslint", "/usr/local/bin/jslint" ], "windows": [] }
Install the plug-in (taking eslint as an example):
Install the npm plug-in for eslint, including:
● sudo npm i eslint babel-eslint -g
● Put the path of the installed tool into the path, that is: /usr/local/bin/eslint
● In the project Configure the .eslintrc file, similar to: (Each project needs to be configured)
● It includes a lot of dependencies. You can enter eslint . in the project, and then follow the prompts to sudo npm i -g for the missing dependencies. ***
Then you can use it happily!
You can right-click to enter sublimelinter to call its function.
.eslintrc file example
{ "env": { "browser": true, "node": true, "es6": true }, "parser": "babel-eslint", "extends" : [ "airbnb" ], "plugins": [ "babel", "promise" ], "ecmaFeatures": { "jsx": true }, "rules": { "semi": [2, "always"], "quotes": [2, "single"] } }
Finally
show the sublimelinter-user.settings after the configuration is completed:
{ "user": { "debug": true, "delay": 0.25, "error_color": "D02000", "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme", "gutter_theme_excludes": [], "lint_mode": "background", "linters": { "eslint": { "@disable": false, "args": [], "ecmaFeatures": { "jsx": true }, "env": { "browser": true, "es6": true, "node": true }, "excludes": [], "extends": [ "standard" ], "parser": "babel-eslint", "plugins": [ "babel", "promise" ], "rules": { "quotes": [ 2, "single" ], "semi": [ 2, "always" ] } }, "jsxhint": { "@disable": false, "args": [], "excludes": [] } }, "mark_style": "stippled underline", "no_column_highlights_line": false, "passive_warnings": false, "paths": { "linux": [], "osx": [ "/usr/local/bin/node", "/usr/local/lib/node_modules", "/usr/local/bin/eslint" ], "windows": [] }, "python_paths": { "linux": [], "osx": [], "windows": [] }, "rc_search_limit": 3, "shell_timeout": 10, "show_errors_on_save": false, "show_marks_in_minimap": true, "syntax_map": { "html (django)": "html", "html (rails)": "html", "html 5": "html", "javascript (babel)": "javascript", "magicpython": "python", "php": "html", "python django": "python", "pythonimproved": "python" }, "warning_color": "DDB700", "wrap_find": true } }
The above is the detailed content of Implement code detection in sublime. For more information, please follow other related articles on the PHP Chinese website!