eslint-config-squarespace
Advanced tools
Comparing version 1.0.1 to 2.0.0
101
index.js
@@ -1,10 +0,91 @@ | ||
var vanilla = require('./vanilla'); | ||
var react = require('./react'); | ||
var eslintrc = JSON.parse(JSON.stringify(vanilla)); | ||
eslintrc.plugins = react.plugins; | ||
Object.keys(react.rules).forEach(function assignRule(ruleId) { | ||
eslintrc.rules[ruleId] = react.rules[ruleId]; | ||
}); | ||
module.exports = eslintrc; | ||
module.exports = { | ||
'extends': 'eslint:recommended', | ||
'parserOptions': { | ||
'ecmaVersion': 2018, | ||
'requireConfigFile': false | ||
}, | ||
'env': { | ||
'browser': true, | ||
'node': true, | ||
'es6': true | ||
}, | ||
'rules': { | ||
'no-extra-boolean-cast': 'error', | ||
'no-extra-semi': 'error', | ||
'brace-style': ['warn', '1tbs', { 'allowSingleLine': true }], | ||
'object-curly-spacing': ['warn', 'always'], | ||
'wrap-iife': ['error', 'any'], | ||
'camelcase': 'error', | ||
'comma-dangle': 'off', | ||
'comma-spacing': 'warn', | ||
'complexity': ['warn', { 'max': 8 }], | ||
'comma-style': ['error', 'last'], | ||
'consistent-return': 'off', | ||
'curly': 'error', | ||
'dot-notation': ['error', { 'allowKeywords': true }], | ||
'eol-last': 'off', | ||
'eqeqeq': 'error', | ||
'indent': ['warn', 2], | ||
'key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }], | ||
'keyword-spacing': 'warn', | ||
'max-depth': ['warn', { 'max': 4 }], | ||
'max-len': ['warn', { 'code': 120, 'tabWidth': 2 }], | ||
'max-params': ['warn', { 'max': 4 }], | ||
'new-cap': 'off', | ||
'new-parens': 'error', | ||
'no-alert': 'error', | ||
'no-array-constructor': 'error', | ||
'no-caller': 'error', | ||
'no-catch-shadow': 'error', | ||
'no-console': 'off', | ||
'no-else-return': 'warn', | ||
'no-empty': 'error', | ||
'no-eval': 'error', | ||
'no-extend-native': 'error', | ||
'no-extra-bind': 'warn', | ||
'no-extra-parens': 'off', | ||
'no-implied-eval': 'error', | ||
'no-invalid-regexp': 'error', | ||
'no-iterator': 'error', | ||
'no-label-var': 'error', | ||
'no-labels': 'error', | ||
'no-lone-blocks': 'error', | ||
'no-lonely-if': 'warn', | ||
'no-loop-func': 'error', | ||
'no-multi-spaces': 'warn', | ||
'no-multi-str': 'error', | ||
'no-native-reassign': 'error', | ||
'no-new-func': 'error', | ||
'no-new-object': 'error', | ||
'no-new-wrappers': 'error', | ||
'no-new': 'error', | ||
'no-octal-escape': 'error', | ||
'no-process-exit': 'error', | ||
'no-proto': 'error', | ||
'no-redeclare': 'off', | ||
'no-return-assign': 'error', | ||
'no-script-url': 'error', | ||
'no-sequences': 'error', | ||
'no-shadow-restricted-names': 'error', | ||
'no-shadow': 'error', | ||
'no-spaced-func': 'error', | ||
'no-trailing-spaces': 'warn', | ||
'no-undef-init': 'error', | ||
'no-underscore-dangle': 'off', | ||
'no-unused-expressions': 'warn', | ||
'no-unused-vars': ['warn', { 'args': 'none' }], | ||
'no-use-before-define': 'error', | ||
'no-whitespace-before-property': 'error', | ||
'no-with': 'error', | ||
'one-var-declaration-per-line': ['warn', 'always'], | ||
'operator-linebreak': ['error', 'after'], | ||
'quote-props': 'off', | ||
'quotes': ['error', 'single', 'avoid-escape'], | ||
'semi-spacing': ['error', { 'before': false, 'after': true }], | ||
'semi': ['warn', 'always'], | ||
'space-infix-ops': 'warn', | ||
'space-unary-ops': ['error', { 'words': true, 'nonwords': false }], | ||
'strict': 'off', | ||
'yoda': ['error', 'never', { 'exceptRange': true }] | ||
} | ||
}; |
{ | ||
"name": "eslint-config-squarespace", | ||
"description": "Eslint shareable configuration for Squarespace", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"author": "Squarespace", | ||
@@ -9,4 +9,3 @@ "license": "Apache-2.0", | ||
"scripts": { | ||
"test": "mocha ./test/runTests.js", | ||
"lint": "eslint" | ||
"test": "jest ./test/*" | ||
}, | ||
@@ -34,11 +33,9 @@ "repository": { | ||
"peerDependencies": { | ||
"eslint": ">=3.0.1" | ||
"eslint": ">=3.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-eslint": "^7.1.1", | ||
"chai": "^3.5.0", | ||
"eslint": "^3.12.2", | ||
"eslint-plugin-react": "^6.8.0", | ||
"mocha": "^3.2.0" | ||
} | ||
"eslint": "^7.19.0", | ||
"jest": "^26.6.3" | ||
}, | ||
"dependencies": {} | ||
} |
# eslint-config-squarespace | ||
Provides the universal configuration for [eslint](https://github.com/eslint) at [Squarespace](https://www.squarespace.com). | ||
Provides the [eslint](https://github.com/eslint) configuration for linting [Squarespace](https://www.squarespace.com) publicly available projects. | ||
## Installation | ||
### Without React | ||
````sh | ||
$ npm install --save-dev eslint-config-squarespace babel-eslint | ||
$ npm install --save-dev eslint-config-squarespace | ||
```` | ||
@@ -15,11 +13,11 @@ | ||
add "extends": "eslint-config-squarespace" to your .eslintrc | ||
add `"extends": "eslint-config-squarespace"` to your `.eslintrc` | ||
#### Example .eslintrc | ||
### Example .eslintrc | ||
````json | ||
{ | ||
"extends": "eslint-config-squarespace/vanilla", | ||
"extends": "eslint-config-squarespace", | ||
"env": { | ||
"browser": true, | ||
"mocha": true, | ||
"jest": true, | ||
"node": true | ||
@@ -30,84 +28,4 @@ } | ||
### With React | ||
````sh | ||
$ npm install --save-dev eslint-config-squarespace babel-eslint eslint-plugin-react | ||
```` | ||
## License | ||
#### Example .eslintrc | ||
````json | ||
{ | ||
"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. | ||
````sh | ||
$ npm install --save eslint-loader | ||
```` | ||
````js | ||
// 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](https://github.com/eslint/eslint/issues/1238). 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. | ||
````vimrc | ||
" 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 |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2
164
1
6726
8
30
1