How to set jshint/jsxhint “esnext” option in Atom

后端 未结 3 1089
醉梦人生
醉梦人生 2021-02-01 15:07

I am using Atom\'s linter, react, and linter-jshint/linter-jsxhint. In my JSX files, I keep getting the warning

3条回答
  •  孤街浪徒
    2021-02-01 15:40

    First possibility, recommended : you can create a .jshintrc in you home directory and jshint will read it in case there is none in the project directory. You might need to restart Atom after.

    Another possibility not recommended : you could also change the config of jshint in Atom and specify the location of your global .jshintrcif for some reason you don't want to put it in your home directory with the flag --config

    'linter-jshint':
      'jshintExecutablePath': /path/to/jshint --config /path/to/.jshinrc
    

    Run 'which jshint' to find the path. It is not recommended because every other .jshinrc file (in the project, etc.) will be ignore:

    jshint will look for this configuration in a number of locations, stopping at the first positive match:

    • The location specified with the --config flag

    • A file named package.json located in the current directory or any parent of the current directory (the configuration should be declared as the jshintConfig attribute of that file's JSON value)

    • A file named .jshintrc located in the current directory or any parent of the current directory

    • A file named .jshintrc located in the current user's "home" directory (where defined)

提交回复
热议问题