Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-config-adjunct

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-adjunct - npm Package Compare versions

Comparing version 4.4.0 to 4.5.0

lib/is-module-available.js

57

index.js
const checkMissing = require('./lib/missing')
const showLoaded = require('./lib/loaded')
const { hasAnyDep } = require('./lib/utils')
const { rules, extraInstallPackage } = require('./packages')
// Base rules
const rules = [
'array-func',
'eslint-comments',
'html',
'json-format',
'markdown',
'no-constructor-bind',
// 'no-secrets', // latest version is buggy
'no-use-extend-native',
'optimize-regex',
'promise',
'sonarjs',
'simple-import-sort',
'switch-case',
'unicorn',
]
// Optionals rules besed on project dependencies
const depRules = [
'lodash',
['lodash', 'lodash-fp'],
'ramda',
'react-redux',
['redux', 'fsa'],
'redux-saga',
// Test tools
'ava',
['chai', 'chai-expect'],
['chai', 'chai-friendly'],
'jasmine',
'jest',
['jest', 'jest-async'],
'mocha',
['mocha', 'mocha-cleanup'],
'qunit',
['grunt-contrib-qunit', 'qunit'],
'cypress',
'prettier',
]
depRules.forEach((depRule) => {
const rule = typeof depRule === 'string' ? [depRule, depRule] : depRule
if (hasAnyDep(rule[0])) rules.push(rule[1])
})
// Extra required optional packages
const extraInstallPkg = [['prettier', 'eslint-config-prettier']]
checkMissing(rules, extraInstallPkg)
checkMissing(rules, extraInstallPackage)
showLoaded(rules, [])

@@ -61,3 +12,5 @@

module.exports = {
extends: rules.map((plugin) => require.resolve(`./rules/${plugin}`)),
extends: rules.map((plugin) =>
require.resolve(`./rules/${plugin.split('@')[0]}`)
),
}

@@ -1,7 +0,7 @@

module.exports = function showLoaded(rules, extraInstallPkg) {
module.exports = function showLoaded(rules, extraInstallPackage) {
const installed = rules.map((plugin) => `eslint-plugin-${plugin}`)
extraInstallPkg.forEach(([rule, pkg]) => {
extraInstallPackage.forEach(([rule, package_]) => {
if (rules.includes(rule)) {
installed.push(pkg)
installed.push(package_)
}

@@ -8,0 +8,0 @@ })

@@ -1,13 +0,14 @@

const isModuleAvailable = require('./isModuleAvailable')
const isModuleAvailable = require('./is-module-available')
const moduleNotAvailable = (pkg) => !isModuleAvailable(pkg)
const moduleNotAvailable = (package_) =>
!isModuleAvailable(package_.split('@')[0])
module.exports = function checkMissing(rules, extraInstallPkg) {
module.exports = function checkMissing(rules, extraInstallPackage) {
const notInstalled = rules
.map((plugin) => `eslint-plugin-${plugin}`)
.filter((pkg) => moduleNotAvailable(pkg))
.filter((package_) => moduleNotAvailable(package_))
extraInstallPkg.forEach(([rule, pkg]) => {
if (rules.includes(rule) && moduleNotAvailable(pkg)) {
notInstalled.push(pkg)
extraInstallPackage.forEach(([rule, package_]) => {
if (rules.includes(rule) && moduleNotAvailable(package_)) {
notInstalled.push(package_)
}

@@ -14,0 +15,0 @@ })

@@ -12,7 +12,7 @@ // From kcd-scripts

const { packageJson: pkg, path: pkgPath } = readPkgUp.sync({
const { packageJson: package_, path: packagePath } = readPkgUp.sync({
cwd: fs.realpathSync(process.cwd()),
})
const appDirectory = path.dirname(pkgPath)
const appDirectory = path.dirname(packagePath)

@@ -22,17 +22,17 @@ const fromRoot = (...p) => path.join(appDirectory, ...p)

// eslint-disable-next-line lodash-fp/no-extraneous-function-wrapping
const hasPkgProp = (props) => arrify(props).some((prop) => has(pkg, prop))
const hasPackageProperty = (properties) =>
arrify(properties).some((property) => has(package_, property)) // eslint-disable-line lodash-fp/no-extraneous-function-wrapping
const hasPkgSubProp = (pkgProp) => (props) =>
hasPkgProp(arrify(props).map((p) => `${pkgProp}.${p}`))
const hasPackageSubProperty = (packageProperty) => (properties) =>
hasPackageProperty(arrify(properties).map((p) => `${packageProperty}.${p}`))
const hasScript = hasPkgSubProp('scripts')
const hasPeerDep = hasPkgSubProp('peerDependencies')
const hasDep = hasPkgSubProp('dependencies')
const hasDevDep = hasPkgSubProp('devDependencies')
const hasAnyDep = (args) =>
[hasDep, hasDevDep, hasPeerDep].some((fn) => fn(args))
const hasScript = hasPackageSubProperty('scripts')
const hasPeerDep = hasPackageSubProperty('peerDependencies')
const hasDep = hasPackageSubProperty('dependencies')
const hasDevelopmentDep = hasPackageSubProperty('devDependencies')
const hasAnyDep = (arguments_) =>
[hasDep, hasDevelopmentDep, hasPeerDep].some((fn) => fn(arguments_))
function parseEnv(name, def) {
if (envIsSet(name)) {
function parseEnvironment(name, def) {
if (environmentIsSet(name)) {
try {

@@ -47,3 +47,3 @@ return JSON.parse(process.env[name])

function envIsSet(name) {
function environmentIsSet(name) {
return (

@@ -56,4 +56,4 @@ process.env.hasOwnProperty(name) && // eslint-disable-line no-prototype-builtins

function uniq(arr) {
return [...new Set(arr)]
function uniq(array) {
return [...new Set(array)]
}

@@ -67,7 +67,7 @@

const pkgJson = fromRoot(`${name}/package.json`)
const packageJson = fromRoot(`${name}/package.json`)
const entryDir = fromRoot(name)
fs.writeFileSync(
pkgJson,
packageJson,
JSON.stringify(

@@ -87,3 +87,3 @@ {

const explorerSync = cosmiconfigSync(moduleName, searchOptions)
const result = explorerSync.search(pkgPath)
const result = explorerSync.search(packagePath)

@@ -98,9 +98,9 @@ return result !== null

hasLocalConfig,
hasPkgProp,
hasPkgProp: hasPackageProperty,
hasScript,
hasAnyDep,
parseEnv,
pkg,
parseEnv: parseEnvironment,
pkg: package_,
uniq,
writeExtraEntry,
}
{
"name": "eslint-config-adjunct",
"version": "4.4.0",
"version": "4.5.0",
"author": "David J. Bradshaw",

@@ -35,2 +35,3 @@ "license": "MIT",

"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.1.0",
"ava": "^3.8.2",

@@ -64,6 +65,7 @@ "babel-eslint": "^10.1.0",

"eslint-plugin-markdown": "^1.0.2",
"eslint-plugin-mocha": "^7.0.0",
"eslint-plugin-mocha": "^7.0.1",
"eslint-plugin-mocha-cleanup": "^1.8.0",
"eslint-plugin-no-constructor-bind": "^2.0.0",
"eslint-plugin-no-secrets": "^0.6.8",
"eslint-plugin-no-secrets": "^0.5.4",
"eslint-plugin-no-unsanitized": "^3.1.1",
"eslint-plugin-no-use-extend-native": "^0.5.0",

@@ -79,2 +81,4 @@ "eslint-plugin-only-error": "^1.0.2",

"eslint-plugin-redux-saga": "^1.1.3",
"eslint-plugin-scanjs-rules": "^0.2.1",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-simple-import-sort": "^5.0.3",

@@ -81,0 +85,0 @@ "eslint-plugin-sonarjs": "^0.5.0",

@@ -55,7 +55,5 @@ # eslint-config-adjunct

- [eslint-plugin-no-use-extend-native](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native)
- [eslint-plugin-no-secrets](https://github.com/nickdeis/eslint-plugin-no-secrets)
- [eslint-plugin-optimize-regex](https://github.com/BrainMaestro/eslint-plugin-optimize-regex)
- [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise)
- [eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort)
- [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs)
- [eslint-plugin-switch-case](https://github.com/lukeapage/eslint-plugin-switch-case)

@@ -68,3 +66,3 @@ - [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)

- [eslint-plugin-fsa](https://github.com/joseph-galindo/eslint-plugin-fsa) - Flux Standard Action
- [eslint-plugin-fsa](https://github.com/joseph-galindo/eslint-plugin-fsa)
- [eslint-plugin-lodash](https://github.com/wix/eslint-plugin-lodash)

@@ -85,2 +83,12 @@ - [eslint-plugin-lodash-fp](https://github.com/jfmengels/eslint-plugin-lodash-fp)

### Security
These plugins add code security rules to esLint.
- [eslint-plugin-no-secrets](https://github.com/nickdeis/eslint-plugin-no-secrets)
- [eslint-plugin-no-unsanitized](https://github.com/mozilla/eslint-plugin-no-unsanitized)
- [eslint-plugin-scanjs-rules](https://github.com/mozfreddyb/eslint-plugin-scanjs-rules)
- [eslint-plugin-security](https://github.com/nodesecurity/eslint-plugin-security)
- [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs)
### Test Libraries

@@ -146,2 +154,3 @@

- unicorn/no-null
- unicorn/prefer-number-properties
- unicorn/prefer-optional-catch-binding

@@ -148,0 +157,0 @@

@@ -5,3 +5,3 @@ module.exports = {

{
files: ['**/*.md'],
files: ['*.md', '**/*.md'],
parserOptions: {

@@ -21,3 +21,2 @@ ecmacFeatures: {

strict: 'off',
'unicorn/filename-case': 'off',
},

@@ -24,0 +23,0 @@ },

@@ -5,2 +5,3 @@ module.exports = {

rules: {
// Rules are not in recommended config
'mocha-cleanup/asserts-limit': 0,

@@ -7,0 +8,0 @@ 'mocha-cleanup/complexity-it': 0,

@@ -6,2 +6,11 @@ module.exports = {

},
overrides: [
{
// Plugin does not play well with these filetypes
files: ['**/*.md', '**/*.json'],
rules: {
'no-secrets/no-secrets': 'off',
},
},
],
}
module.exports = {
extends: ['plugin:unicorn/recommended'],
overrides: [
{
files: ['*.md', '**/*.md'],
rules: {
'unicorn/filename-case': 'off',
},
},
],
rules: {

@@ -8,4 +16,5 @@ 'unicorn/prefer-exponentiation-operator': 0,

'unicorn/no-null': 0,
'unicorn/prefer-number-properties': 0,
'unicorn/prefer-optional-catch-binding': 0,
},
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc