Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (isMonorepo) {
exports.allowModules = monorepoPkgs.reduce((acc, pkg) => {
const pkgJson = tryRequirePkg(resolve(pkg, 'package.json'))
if (!pkgJson) {
return acc
}
const { name, peerDependencies = {}, dependencies = {} } = pkgJson
return acc.concat(
name,
Object.keys(peerDependencies),
Object.keys(dependencies),
)
}, [])
}
exports.isWebpackAvailable = isPkgAvailable('webpack')
// https://webpack.js.org/api/module-variables/#__resourcequery-webpack-specific
exports.webpackSpecVars = [
'__resourceQuery',
'__non_webpack_require__',
'__webpack_chunk_load__',
'__webpack_hash__',
'__webpack_modules__',
'__webpack_public_path__',
'__webpack_require__',
'DEBUG',
]
exports.camelCaseRule = [
2,
{
exports.stories = {
files: '**/stories/**/*.{js,jsx,mdx,ts,tsx,vue}',
rules: nonSourceRules,
}
exports.config = {
files: ['.*rc.js', '*.config.{js,ts}'],
rules: nonSourceRules,
}
exports.overrides = []
.concat(
isPkgAvailable('@babel/core') && exports.js,
isTsAvailable && exports.ts,
isPkgAvailable('tslint') && lintFile && exports.tslint,
isReactAvailable && exports.react,
isReactAvailable && exports.reactHooks,
isReactAvailable && exports.reactTs,
isVueAvailable && exports.vue,
isAngularAvailable && exports.angular,
exports.mdx,
exports.jest,
exports.test,
exports.stories,
exports.config,
exports.dTs,
)
.filter(Boolean)
'prettier --write',
'git add',
],
'.!(*browserslist|npm|yarn)rc': ['prettier --write', 'git add'],
'.{editorconfig|browserslistrc|npmrc|yarnrc}': [
'prettier --write --parser sh',
'git add',
],
Dockerfile: ['prettier --write', 'git add'],
}
if (isPkgAvailable('stylelint')) {
config['*.{css,less,sass,scss,vue}'] = ['stylelint --cache --fix', 'git add']
}
if (isPkgAvailable('@pkgr/imagemin')) {
config['*.{gif,jpeg,jpg,png,svg,webp}'] = ['i', 'git add']
}
module.exports = config
const { isPkgAvailable } = require('@pkgr/utils')
const config = {
'*.{*ignore,*sh,env,env.*,gql,html,json,properties,pug,rb,vue,toml,yaml,yml}': [
'prettier --write',
'git add',
],
'.!(*browserslist|npm|yarn)rc': ['prettier --write', 'git add'],
'.{editorconfig|browserslistrc|npmrc|yarnrc}': [
'prettier --write --parser sh',
'git add',
],
Dockerfile: ['prettier --write', 'git add'],
}
if (isPkgAvailable('stylelint')) {
config['*.{css,less,sass,scss,vue}'] = ['stylelint --cache --fix', 'git add']
}
if (isPkgAvailable('@pkgr/imagemin')) {
config['*.{gif,jpeg,jpg,png,svg,webp}'] = ['i', 'git add']
}
module.exports = config
const { isPkgAvailable } = require('@pkgr/utils')
const conventionalConfig = require('@commitlint/config-conventional')
const lernaScopesConfig = require('@commitlint/config-lerna-scopes')
const MERGE_PROPERTIES = ['rules', 'utils']
module.exports = isPkgAvailable('lerna')
? Object.assign(
{},
conventionalConfig,
MERGE_PROPERTIES.reduce((config, property) => {
config[property] = Object.assign(
{},
conventionalConfig[property],
lernaScopesConfig[property],
)
return config
}, {}),
)
: conventionalConfig
const { isPkgAvailable, tryFile } = require('@pkgr/utils')
const config = Object.assign({}, require('./base'))
if (isPkgAvailable('eslint')) {
Object.assign(
config,
{
'*.{js,jsx,md,mdx,mjs,vue}': [
'eslint --cache -f friendly --fix',
'git add',
],
},
require('./ts-eslint'),
)
}
if (isPkgAvailable('tslint') && tryFile('tslint.json')) {
Object.assign(config, require('./ts-tslint'))
}
rules: exports.test.rules,
}
exports.stories = {
files: '**/stories/**/*.{js,jsx,mdx,ts,tsx,vue}',
rules: nonSourceRules,
}
exports.config = {
files: ['.*rc.js', '*.config.{js,ts}'],
rules: nonSourceRules,
}
exports.overrides = []
.concat(
isPkgAvailable('@babel/core') && exports.js,
isTsAvailable && exports.ts,
isPkgAvailable('tslint') && lintFile && exports.tslint,
isReactAvailable && exports.react,
isReactAvailable && exports.reactHooks,
isReactAvailable && exports.reactTs,
isVueAvailable && exports.vue,
isAngularAvailable && exports.angular,
exports.mdx,
exports.jest,
exports.test,
exports.stories,
exports.config,
exports.dTs,
)
.filter(Boolean)