How to use the @pkgr/utils.tryPkg function in @pkgr/utils

To help you get started, we’ve selected a few @pkgr/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 1stG / configs / packages / eslint-config / overrides.js View on Github external
exports.dTs = {
  files: '*.d.ts',
  rules: {
    '@typescript-eslint/no-explicit-any': 0,
    '@typescript-eslint/no-extraneous-class': 0,
    '@typescript-eslint/no-namespace': 0,
    '@typescript-eslint/no-unused-vars': 0,
    'import/no-duplicates': 0,
    'import/order': 0,
    'node/no-extraneous-import': 0,
  },
}

const TSLINT_CONFIG = tryFile(resolve('tslint.json'))
const lintFile = TSLINT_CONFIG || tryPkg('@1stg/tslint-config')

exports.tslint = {
  files: '*.{ts,tsx}',
  excludedFiles: '*.d.ts',
  plugins: TSLINT_CONFIG ? ['@typescript-eslint/tslint'] : undefined,
  rules: Object.assign(
    {
      // `ordered-imports` of tslint is better for now
      'import/order': 0,
    },
    TSLINT_CONFIG
      ? undefined
      : {
          '@typescript-eslint/tslint/config': [
            2,
            {
github 1stG / configs / packages / eslint-config / overrides.js View on Github external
},
    ],
    'babel/new-cap': 2,
    'babel/no-invalid-this': 2,
    'babel/no-unused-expressions': 2,
    'babel/valid-typeof': 2,
  },
}

exports.js = jsBase

const project =
  tryFile(resolve('tsconfig.eslint.json')) ||
  tryFile(resolve('tsconfig.base.json')) ||
  tryFile(resolve('tsconfig.json')) ||
  tryPkg('@1stg/tsconfig')

const resolveSettings = {
  'import/external-module-folders': [
    'node_modules',
    'node_modules/@d-ts',
    'node_modules/@types',
  ],
  'import/resolver': {
    ts: {
      alwaysTryTypes: true,
      directory: project,
    },
  },
  node: {
    resolvePaths: [
      tryFile('node_modules/@d-ts', true),
github 1stG / configs / packages / eslint-config / overrides.js View on Github external
const {
  isAngularAvailable,
  isReactAvailable,
  isPkgAvailable,
  isTsAvailable,
  isVueAvailable,
  tryFile,
  tryPkg,
} = require('@pkgr/utils')

const { camelCaseRule, magicNumbers } = require('./_util')

const configFile =
  tryFile(resolve('babel.config.js')) ||
  tryFile(resolve('.babelrc.js')) ||
  tryPkg('@1stg/babel-preset/config')

const jsBase = {
  files: '*.{mjs,js,jsx}',
  parser: 'babel-eslint',
  parserOptions: configFile && {
    babelOptions: {
      configFile,
    },
  },
  plugins: ['babel'],
  rules: {
    camelcase: 0,
    'new-cap': 0,
    'no-invalid-this': 0,
    'no-unused-expressions': 0,
    'valid-typeof': 0,

@pkgr/utils

Shared utils for `@pkgr` packages or any package else

MIT
Latest version published 9 months ago

Package Health Score

74 / 100
Full package analysis

Similar packages