Socket
Book a DemoInstallSign in
Socket

@linzjs/style

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@linzjs/style

[![Build Status](https://github.com/linz/style-js/workflows/Build/badge.svg)](https://github.com/linz/style-js/actions) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/linz/style-js/blob/master/LICENSE)

latest
Source
npmnpm
Version
5.4.0
Version published
Weekly downloads
16K
59.21%
Maintainers
0
Weekly downloads
 
Created
Source

@linzjs/style

Build Status License

NPM configuration for base typescript projects

Includes:

  • Prettier
  • Eslint
  • Typescript

And configuration for saneish defaults, which can be extended

Most of these are the raw defaults/recommended settings from typescript, eslint and prettier.

export class FooBar {
  get foo(): number {
    return 1;
  }

  async bar(): Promise<string> {
    return 'bar';
  }

  /**
   * @param foo foo to bar
   */
  fooBar(foo = 'foo'): string {
    return `${foo}bar`;
  }
}

IDE Usage

Usage VS Code

  • Install eslint using the extensions menu
  • Add the following to your settings.json
"editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
},
"eslint.validate": ["javascript"],

Usage with IntelliJ

IntelliJ has ESLint support by default,

  • Open the settings in Languages & Frameworks > JavaScript > Code Quality Tools > ESLint
  • Check Automatic ESLint Configuration

Project Usage

  • Install LINZ Style
npm install @linzjs/style
  • Applying eslint config There are two ways to apply the config

Either create the base configuration files

# If on windows run `node ./node_modules/@linzjs/style/build/src/install.js`
# - tsconfig.json
# - .eslintrc.cjs
# - .prettierrc.cjs
npx linz-style-install

Or extend your existing eslintrc.js config

Example extending the .eslintrc.js file in your project

module.exports = {
  extends: ["./node_modules/@linzjs/style/.eslintrc.cjs"],

  overrides: [
    {
      /** Overrides for typescript */
      files: ["**/*.ts", "**/*.tsx"],      
      rules: {
        "@typescript-eslint/super-crazy-hook-rule": "error",
      },
    },
  ]
}
  • Apply the formatting/linting to all source code
npx eslint .

Migration from 3.x to 4.x

See Migration Docs

FAQs

Package last updated on 23 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts