drop

Something that I wanted to say

View on GitHub

Fixing Spacemacs, smart search does not ignore node_modules

Using Spacemacs as Javascript backend development IDE, I needed to make following changes.

npm install -g eslint eslint-plugin-jest tern jsonlint standard
   dotspacemacs-configuration-layers
   '(
     git
     markdown
     syntax-checking
     version-control
     html
     javascript
   ..
   ;; updated the search tools order to ack first.
   dotspacemacs-search-tools '("ack" "ag" "pt" "grep")
(defun dotspacemacs/user-init ()
  ;; to tell js2-mode that we are working with node modules
  (setq js2-include-node-externs t)

.tern-project file:

{
  "libs": [ ],
  "loadEagerly": false,
  "plugins": {
            "commonjs": {},
            "node": {},
            "requirejs": {},
            "node_resolve": {}
  }
}

.eslintrc.json

{
    "env": {
        "browser": true,
        "commonjs": true,
        "es6": true,
        "node": true,
        "jest/globals": true
    },
    "plugins": ["jest"],
    "extends": [
        "eslint:recommended",
        "plugin:jest/recommended"
    ],
    "globals": {
        "process": "readonly",
        "exports": "writable"
    },
    "parserOptions": {
        "ecmaVersion": 2018
    },
    "rules": {
        "no-console": "off",
        "no-process-env": "off",
        "jest/no-disabled-tests": "warn",
        "jest/no-focused-tests": "error",
        "jest/no-identical-title": "error",
        "jest/prefer-to-have-length": "warn",
        "jest/valid-expect": "error"
    }
}

This should fix issues including:

Learned js2-include-node-externs from here

Learned auto-complete and go-to-definition across files from here

You can find my .spacemacs file here


home

Built with Spacemacs