Naughty Programmer's Madness
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    eslint-config-squarespacepublic

    eslint-config-squarespace

    Provides the universal configuration for eslint at Squarespace.

    Installation

    Without React

    $ npm install --save-dev eslint-config-squarespace babel-eslint

    Then:

    add "extends": "eslint-config-squarespace" to your .eslintrc

    Example .eslintrc

    {
      "extends": "eslint-config-squarespace/vanilla",
      "env": {
        "browser": true,
        "mocha": true,
        "node": true
      }
    }

    With React

    $ npm install --save-dev eslint-config-squarespace babel-eslint eslint-plugin-react

    Example .eslintrc

    {
      "extends": "squarespace",
      "env": {
        "browser": true,
        "mocha": true,
        "node": true
      },
      "plugins": [
        "react"
      ]
    }

    Integrating with Webpack

    You may add eslint config to a webpack build process by using a preloader and some eslint config. There should be no need to reference this config file provided the .eslintrc 'extends' property is set.

    $ npm install --save eslint-loader
    // webpack.config.js
    module: {
      eslint: {
        configFile: path.join(pathsToESlint, '.eslintrc'),
        failOnError: true
      },
      module: {
        preLoaders: [
          {
            test: /\.jsx?$/,
            loader: 'eslint',
            include: pathsToFiles
          }
        ],
        ..
      }

    Troubleshooting

    Webpack

    The webpack plugin for pre-linting is notoriously slow, because it can not leverage and form of caching available to either eslint or webpack. If it is too slow, try moving it to the npm command that starts the webpack build.

    Global Eslint

    Global CLI installations of eslint cannot find local modules. This is expected behavior. Tools or scripts that rely on such global installations must be rewritten or modified to find the correct node_modules folder.

    Fix Syntastic for Vim

    If you are using syntastic, adding the following to your .vimrc should fix eslint.

    " Kludge to fix global/local.
    let g:syntastic_javascript_checkers = ['eslint']
     
    let local_eslint = finddir('node_modules', '.;') . '/.bin/eslint'
    if matchstr(local_eslint, "^\/\\w") == ''
        let local_eslint = getcwd() . "/" . local_eslint
    endif
    if executable(local_eslint)
        let g:syntastic_javascript_eslint_exec = local_eslint
    endif

    License

    Apache-2 copyright Squarespace

    install

    npm i eslint-config-squarespace

    Downloadsweekly downloads

    6

    version

    1.0.1

    license

    Apache-2.0

    repository

    githubgithub

    last publish

    collaborators

    • avatar