Example of SublimeText3 configuring react syntax check
Editor to share with you an example of SublimeText3 configuration react grammar checking, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
SublimeText3 is a cross-platform code editor software. SublimeText3 can not only write code but also edit text. It is an indispensable tool for programmers. Specific content:
1. Install nodejs
two。 Open the terminal and install the eslint check package and the react check plug-in package:
Npm install-g eslintnpm install-g eslint-plugin-react
3. Install the plug-in in Sublime:
SublimeLinterSublimeLinter-contrib-eslint
4. Run eslint-- init
Configure the initialization file according to the prompts to generate the
5. Configure .eslintrc
.eslintrc.json
{"plugins": [/ / "react", "html"], "env": {"node": true, "jquery": true, "es6": true, "browser": true} "globals": {"angular": false}, "parser": "babel-eslint", "rules": {/ / official document http://eslint.org/docs/rules/ Parameter: 0 close 1 warning 2 error / / "quotes": [0, "single"], / / it is recommended to use single quotes / / "no-inner-declarations": [0, "both"], / / it is not recommended to declare variables or functions "no-extra-boolean-cast": 1 inside the {} code block / / extra exclamation point to Boolean "no-extra-semi": 1, / extra semicolon "no-extra-parens": 0, / / extra parenthesis "no-empty": 1 / / empty code block / / No "no-use-before-define" is defined before use: [0, "nofunc"], "complexity": [0,10] / / Cyclomatic complexity is greater than * / / define the superfluous comma "comma-dangle" at the end of an array or object: [0, "never"], / / global variables are not allowed to be assigned For example, window = 'abc' "no-global-assign": ["error", {/ / define exception / / "exceptions": ["Object"]}], "no-var": 0, / / replace var "no-const-assign": 2 with let or const / / do not allow const to reassign "no-class-assign": 2, / / do not allow "no-debugger": 1 to class, / / debugger debug code did not delete "no-console": 0, / / console did not delete "no-constant-condition": 2 / / constant as condition "no-dupe-args": 2, / Parameter repeat "no-dupe-keys": 2, / / object attribute repeat "no-duplicate-case": 2, / / case repeat "no-empty-character-class": 2 / / regular cannot match any value "no-invalid-regexp": 2, / invalid regular "no-func-assign": 2, / / function is assigned "valid-typeof": 1, / / invalid type judgment "no-unreachable": 2 / / impossible code "no-unexpected-multiline": 2, / / missing semicolon at the end of the line may lead to some unexpected conditions "no-sparse-arrays": 1, / / extra comma "no-shadow-restricted-names": 2, / / keyword conflict with naming "no-undef": 1 / / variable not defined "no-unused-vars": 1, / / variable defined without using "no-cond-assign": 2, / / conditional statement forbids assignment operation "no-native-reassign": 2, / / forbids overwriting native object "no-mixed-spaces-and-tabs": 0 / / Code style optimization-"no-irregular-whitespace": 0, "no-else-return": 0, / / return in else code block Else is superfluous "no-multi-spaces": 0, / / multiple spaces are not allowed / / object is not allowed to measure directly: the latter space is not preceded by "key-spacing": [0, {"beforeColon": false "afterColon": true}], "block-scoped-var": 1, / / variables should be declared in an external context Should not be in {} code block "consistent-return": 1, / function return value may be of a different type "accessor-pairs": 1, / / object getter/setter method needs to appear in pairs / / newline call object method point operator should be written at the beginning of the line "dot-location": [1 "property"], "no-lone-blocks": 1, / redundant {} nested "no-labels": 1, / / useless tag "no-extend-native": 1, / / prohibit the extension of native object "no-floating-decimal": 1 / / floating point type needs to be completely forbidden. 1 or 2. Write "no-loop-func": 1, / / prohibit defining the function "no-new-func" in the body of the loop: 1, / / prohibit new Function (...) Write "no-self-compare": 1, / / do not compare with yourself as a condition "no-sequences": 1, / / prohibit the comma operator "no-throw-literal": 1 that may lead to ambiguous results. / / prohibit throwing a direct quantity should be an Error object / / assign operation "no-return-assign" when return is not allowed: [1, "always"] / / it is not allowed to declare "no-redeclare" repeatedly: [1, {"builtinGlobals": true}] / / expression "no-unused-expressions" not executed: [0, {"allowShortCircuit": true, "allowTernary": true}] "no-useless-call": 1, / / meaningless function call or apply "no-useless-concat": 1, / / meaningless string concat "no-void": 1, / / disable void "no-with": 1, / / disable with "space-infix-ops": 0 Space before and after / / operator / / jsdoc "valid-jsdoc": [0, {"requireParamDescription": true, "requireReturnDescription": true}] / / tag is not commented "no-warning-comments": [1, {"terms": ["todo", "fixme" "any other term"], "location": "anywhere"}] "curly": 0 / / if, else, while, for code blocks are surrounded by {}. These are all the contents of the article "examples of SublimeText3 configuring react Syntax checking". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!