@atws/projen-config
TypeScript icon, indicating that this package has built-in type declarations

1.9.5 • Public • Published

@atws/projen-config

npm

This package contains extensions for projen.

Usage

Install the package:

yarn add -D @atws/projen-config

Add to your .projenrc.ts file:

import { awscdk } from 'projen'
import {
  PrettierConfig,
  EslintConfig,
  VscodeConfig,
  GitConfig,
} from "@atws/projen-config"

const project = new awscdk.AwsCdkConstructLibrary({ 
  devDeps: ["@atws/projen-config"],
})

new PrettierConfig(project)

new EslintConfig(project, {
  cdkFileRegex: "**/src/**/*.ts",
  reactFileRegex: "**/webapp/**/*.{ts,tsx}",
})

new VscodeConfig(project, {
  additionalSearchExclusion: {
    '**/public': true,
  },
})

new GitConfig(project)

Features

Setup @atws/prettier-config

An opinionated base config for prettier. In contrast to the default config, it uses single quotes, adds a trailing comma to objects and arrays and does not use semicolons at the end.

new PrettierConfig(project)

Setup @atws/eslint-config

Add an opinionated base config for eslint. It allows to specify the file regex for projects that use AWS CDK and/or React.

new EslintConfig(project, {
  cdkFileRegex: "**/src/**/*.ts",
  reactFileRegex: "**/webapp/**/*.{ts,tsx}",
})

Setup a VS Code workspace settings file

Add a .vscode/settings.json and .vscode/extensions.json file to the project. It defines some standard search exclusions and enables formatOnSave. The extensions file is used to recommend extensions that should be installed for the project.

new VscodeConfig(project, {
  additionalSearchExclusion: {
    '**/public': true,
  },
  additionalSettings: {
    'editor.stickyScroll.enabled': true,
  },
  vscodeExtensions: {
    addCdkExtensions: true,
    addCoreExtensions: true,
    additionalExtensions: ['ms-azuretools.vscode-docker'],
    addNodeExtensions: true,
    addProductivityExtensions: true,
    addReactExtensions: true,
    addTailwindCSSExtensions: true,
  },
})

Setup a .gitattributes file

Modify the .gitattributes file to use LF line endings for all files, use binary encoding and treat VSCode settings files as JSON5.

new GitConfig(project, {
  gitAttributes: {
    additionalLines: [
      {
        glob: '/packages/api/generated/**',
        attribute: 'linguist-generated',
      },
    ],
  },
})

Readme

Keywords

Package Sidebar

Install

npm i @atws/projen-config

Weekly Downloads

31

Version

1.9.5

License

MIT

Unpacked Size

16.8 kB

Total Files

4

Last publish

Collaborators

  • nimmervoll