eslint-config-adjunct
Advanced tools
Comparing version 4.3.0 to 4.4.0
10
index.js
@@ -31,2 +31,6 @@ const checkMissing = require('./lib/missing') | ||
'redux-saga', | ||
// Test tools | ||
'ava', | ||
['chai', 'chai-expect'], | ||
['chai', 'chai-friendly'], | ||
'jasmine', | ||
@@ -36,2 +40,6 @@ 'jest', | ||
'mocha', | ||
['mocha', 'mocha-cleanup'], | ||
'qunit', | ||
['grunt-contrib-qunit', 'qunit'], | ||
'cypress', | ||
'prettier', | ||
@@ -49,3 +57,3 @@ ] | ||
checkMissing(rules, extraInstallPkg) | ||
showLoaded(rules, extraInstallPkg) | ||
showLoaded(rules, []) | ||
@@ -52,0 +60,0 @@ // Disable some rules in unit tests |
@@ -5,5 +5,5 @@ module.exports = function isModuleAvailable(name) { | ||
return true | ||
} catch(error) { | ||
} catch (error) { | ||
return false | ||
} | ||
} |
@@ -1,18 +0,14 @@ | ||
const makePluginName = (plugin) => `eslint-plugin-${plugin}` | ||
module.exports = function showLoaded(rules, extraInstallPkg) { | ||
const installed = rules.map((plugin) => `eslint-plugin-${plugin}`) | ||
module.exports = function showLoaded(rules, extraInstallPkg) { | ||
function checkExtra([rule, pkg]) { | ||
extraInstallPkg.forEach(([rule, pkg]) => { | ||
if (rules.includes(rule)) { | ||
installed.push(pkg) | ||
} | ||
} | ||
}) | ||
const installed = rules.map(makePluginName) | ||
extraInstallPkg.forEach(checkExtra) | ||
console.log(` | ||
EsLint-config-adjunct loaded the following packages: | ||
${installed.join('\n ')} | ||
`) | ||
${installed.join('\n ')}`) | ||
} |
const isModuleAvailable = require('./isModuleAvailable') | ||
const moduleNotAvailable = (pkg) => !isModuleAvailable(pkg) | ||
const makePluginName = (plugin) => `eslint-plugin-${plugin}` | ||
module.exports = function checkMissing(rules, extraInstallPkg) { | ||
function checkExtra([rule, pkg]) { | ||
const notInstalled = rules | ||
.map((plugin) => `eslint-plugin-${plugin}`) | ||
.filter((pkg) => moduleNotAvailable(pkg)) | ||
extraInstallPkg.forEach(([rule, pkg]) => { | ||
if (rules.includes(rule) && moduleNotAvailable(pkg)) { | ||
notInstalled.push(pkg) | ||
} | ||
} | ||
}) | ||
const notInstalled = rules.map(makePluginName).filter(moduleNotAvailable) | ||
extraInstallPkg.forEach(checkExtra) | ||
if (notInstalled.length === 0) return | ||
@@ -17,0 +17,0 @@ |
@@ -8,3 +8,3 @@ // From kcd-scripts | ||
const arrify = require('arrify') | ||
const has = require('lodash.has') | ||
const has = require('lodash/has') | ||
const readPkgUp = require('read-pkg-up') | ||
@@ -22,2 +22,3 @@ const { cosmiconfigSync } = require('cosmiconfig') | ||
// eslint-disable-next-line lodash-fp/no-extraneous-function-wrapping | ||
const hasPkgProp = (props) => arrify(props).some((prop) => has(pkg, prop)) | ||
@@ -39,3 +40,3 @@ | ||
return JSON.parse(process.env[name]) | ||
} catch (err) { | ||
} catch (error) { | ||
return process.env[name] | ||
@@ -49,3 +50,3 @@ } | ||
return ( | ||
process.env.hasOwnProperty(name) && | ||
process.env.hasOwnProperty(name) && // eslint-disable-line no-prototype-builtins | ||
process.env[name] && | ||
@@ -57,3 +58,3 @@ process.env[name] !== 'undefined' | ||
function uniq(arr) { | ||
return Array.from(new Set(arr)) | ||
return [...new Set(arr)] | ||
} | ||
@@ -60,0 +61,0 @@ |
{ | ||
"name": "eslint-config-adjunct", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"author": "David J. Bradshaw", | ||
@@ -14,4 +14,4 @@ "license": "MIT", | ||
"ci-test": "npm run test", | ||
"eslint": "eslint --color *.{js,json,md} rules/*.js", | ||
"eslint:fix": "eslint --color --fix *.{js,md} rules/*.js", | ||
"eslint": "eslint --color *.{js,json,md} rules/**.js lib/**.js docs/**.md", | ||
"eslint:fix": "eslint --color --fix *.{js,md} rules/**.js lib/**.js docs/**.md", | ||
"prepublishOnly": "eslint-find-rules --unused --no-core", | ||
@@ -36,12 +36,25 @@ "test": "npm run eslint && npm run prepublishOnly" | ||
"devDependencies": { | ||
"ava": "^3.8.2", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^6.8.0", | ||
"chai": "^4.2.0", | ||
"cypress": "^4.7.0", | ||
"eslint": "^7.1.0", | ||
"eslint-config-babel": "^9.0.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-find-rules": "^3.4.0", | ||
"eslint-plugin-array-func": "^3.1.5", | ||
"eslint-plugin-eslint-comments": "^3.1.2", | ||
"eslint-config-react": "^1.1.7", | ||
"eslint-config-standard": "^14.1.1", | ||
"eslint-config-vue": "^2.0.2", | ||
"eslint-find-rules": "^3.5.0", | ||
"eslint-plugin-array-func": "^3.1.6", | ||
"eslint-plugin-ava": "^10.3.0", | ||
"eslint-plugin-babel": "^5.3.0", | ||
"eslint-plugin-chai-expect": "^2.1.0", | ||
"eslint-plugin-chai-friendly": "^0.6.0", | ||
"eslint-plugin-cypress": "^2.11.1", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-flowtype": "^5.1.3", | ||
"eslint-plugin-fsa": "^1.0.12", | ||
"eslint-plugin-html": "^6.0.2", | ||
"eslint-plugin-jasmine": "^4.1.1", | ||
"eslint-plugin-jest": "^23.8.2", | ||
"eslint-plugin-jest": "^23.13.2", | ||
"eslint-plugin-jest-async": "^1.0.3", | ||
@@ -52,4 +65,5 @@ "eslint-plugin-json-format": "^2.0.1", | ||
"eslint-plugin-markdown": "^1.0.2", | ||
"eslint-plugin-mocha": "^6.3.0", | ||
"eslint-plugin-no-constructor-bind": "^1.2.8", | ||
"eslint-plugin-mocha": "^7.0.0", | ||
"eslint-plugin-mocha-cleanup": "^1.8.0", | ||
"eslint-plugin-no-constructor-bind": "^2.0.0", | ||
"eslint-plugin-no-secrets": "^0.6.8", | ||
@@ -61,3 +75,5 @@ "eslint-plugin-no-use-extend-native": "^0.5.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-qunit": "^4.2.0", | ||
"eslint-plugin-ramda": "^2.5.1", | ||
"eslint-plugin-react": "^7.20.0", | ||
"eslint-plugin-react-redux": "^3.0.3", | ||
@@ -68,14 +84,17 @@ "eslint-plugin-redux-saga": "^1.1.3", | ||
"eslint-plugin-switch-case": "^1.1.2", | ||
"eslint-plugin-unicorn": "^19.0.1", | ||
"eslint-plugin-unicorn": "^20.1.0", | ||
"eslint-plugin-vue": "^6.2.2", | ||
"husky": "^4.2.5", | ||
"in-publish": "^2.0.1", | ||
"jasmine": "^3.5.0", | ||
"jest": "^25.5.1", | ||
"lint-staged": "^10.2.0", | ||
"jest": "^26.0.1", | ||
"lint-staged": "^10.2.7", | ||
"lodash": "^4.17.15", | ||
"lodash-fp": "^0.10.4", | ||
"mocha": "^7.1.2", | ||
"mocha": "^7.2.0", | ||
"prettier": "^2.0.5", | ||
"prettier-cli": "^0.1.0", | ||
"qunit": "^2.10.0", | ||
"ramda": "^0.27.0", | ||
"react": "^16.13.1", | ||
"react-redux": "^7.2.0", | ||
@@ -82,0 +101,0 @@ "redux": "^4.0.5", |
# eslint-config-adjunct | ||
> _A reasonable collection of *plugins* to use alongside your main esLint configuration._ | ||
> _A reasonable collection of *plugins* to use alongside your main esLint configuration_ | ||
@@ -17,3 +17,3 @@ This config is designed to be used alongside any of the major esLint configs, such as [airbnb](https://github.com/airbnb/javascript), [standard](https://github.com/standard/eslint-config-standard) or [eslint:recommended](https://eslint.org/docs/rules/). It provides a range of useful plugins that are often too time-consuming to setup and provides an easy way to install just the plugins you need, based on your project's dependencies. | ||
Extend your `.eslintrc`, with `adjunct`, which should be the last item in the `extends` array. For example if your using `eslint-config-airbnb` as your main rule set, your `.eslintrc` should look like this: | ||
Extend your `.eslintrc`, with `adjunct`, which should be the last item in the `extends` array. For example if your using `eslint-config-airbnb` as your main rule set, your `.eslintrc` should look like the following. For more advanced use cases see the example configurations for [TypeScript](https://github.com/davidjbradshaw/eslint-config-adjunct/blob/master/docs/typescript.md) and [Vue](https://github.com/davidjbradshaw/eslint-config-adjunct/blob/master/docs/vue.md). | ||
@@ -37,2 +37,4 @@ ```json | ||
## Install Dependencies | ||
@@ -81,2 +83,4 @@ | ||
The prettier configs for different eslint plugins are also automatically included based on which eslint plugins have been installed into your project. | ||
### Test Libraries | ||
@@ -86,2 +90,5 @@ | ||
- [eslint-plugin-ava](https://github.com/avajs/eslint-plugin-ava) | ||
- [eslint-plugin-chai-expect](https://github.com/turbo87/eslint-plugin-chai-expect) | ||
- [eslint-plugin-chai-friendly](https://github.com/ihordiachenko/eslint-plugin-chai-friendly) | ||
- [eslint-plugin-jasmine](https://github.com/tlvince/eslint-plugin-jasmine) | ||
@@ -91,2 +98,5 @@ - [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) | ||
- [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha) | ||
- [eslint-plugin-mocha-cleanup](https://github.com/onechiporenko/eslint-plugin-mocha-cleanup/) | ||
- [eslint-plugin-qunit](https://github.com/platinumazure/eslint-plugin-qunit) | ||
- [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress) | ||
@@ -138,2 +148,3 @@ ## Rules | ||
- unicorn/no-null | ||
- unicorn/prefer-optional-catch-binding | ||
@@ -140,0 +151,0 @@ The following rules are disabled due to clashing with other plugins |
@@ -10,3 +10,3 @@ const { hasAnyDep } = require('../lib/utils') | ||
'react', | ||
'standard', | ||
['eslint-config-standard', 'prettier/standard'], | ||
'vue', | ||
@@ -25,2 +25,4 @@ 'unicorn', | ||
console.log(configs.map((config) => ` eslint-config-${config}\n`).join('')) | ||
module.exports = { | ||
@@ -27,0 +29,0 @@ extends: configs, |
@@ -0,1 +1,3 @@ | ||
console.log(' ') | ||
module.exports = { | ||
@@ -5,4 +7,4 @@ overrides: [ | ||
files: [ | ||
'**/*.spec.js', | ||
'**/*.test.js', | ||
'**/*.spec.{j,t}s', | ||
'**/*.test.{j,t}s', | ||
'**/tests/**', | ||
@@ -9,0 +11,0 @@ '**/test/**', |
@@ -8,3 +8,4 @@ module.exports = { | ||
'unicorn/no-null': 0, | ||
'unicorn/prefer-optional-catch-binding': 0, | ||
}, | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27306
46
608
155
64