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

@synatic/eslint-config-synatic-node

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synatic/eslint-config-synatic-node

Global repo for how code should be linted and styled

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

lint-and-code-style

Global repo for how linting and code styling should be done for Synatic projects.

Making changes

In the root of the project is a .eslintrc.json file, this is where the majority of the rules, plugins and config will live and where you should primarily be making changes. The base file is for node projects that use mocha. You can test out changes to the base config by adding code to the ./lib-examples/ folder and your editor should be able to pick up any issues with the code which will allow you to refine the rules and verify that they work the way you would like them too.

Once you have the rules setup the way you would like to you can run the npm run copy command and this will take the config in the .eslintrc.json file and copy it to ./lib/index.js where it will be used in other projects once published.

The library also supports more advanced configuration for other project types, for example projects that use jest can make use of both the base configuration file in the root together with the jest specific config in ./lib/jest.js by having their project extend @synatic/eslint-config-synatic-node/lib/jest. Currently there is no way to test these specific configurations in this project without copying them to the .eslintrc.json file and testing them, but do not leave them there when committing or else they will apply to the shared base configuration.

Once you have made all the above changes and ran the npm run copy command you can commit to git run the npm version <major,minor,patch> command to increment the version, push to develop and submit a PR as normal.

Adding to your project

To add the shared configuration to your project you can do the following:

  1. run npm i -D @synatic/eslint-config-synatic-node in your project
  2. create a .eslintrc.json file in your project
  3. Add the following code:
    {
        "env": {},
        "extends": ["@synatic/eslint-config-synatic-node"],
        "globals": {},
        "parserOptions": {},
        "overrides": [],
        "rules": {}
    }
    
  4. If you would prefer to use a different config from the base one, simply replace the extends in the above example with your desired one.
  5. create a .prettierrc.json in your project and inside it add the code from this repositories version of the file as this will be the most up to date version
  6. Install the peer dependencies listed in this project's package.json file, which can be found under peerDependencies
  7. Ensure your package.json has the correct engine section, e.g.:
    "engines": {
        "node": ">=14.0.0",
        "npm": ">=6.0.0"
    },
  1. Ensure your package.json has the required scripts:
    "lint": "eslint .",
    "lint-fix": "eslint . --fix",
    "lint-errors": "eslint . --quiet",
    "prettier": "prettier . --write"

Configs available

  • @synatic/eslint-config-synatic-node
  • @synatic/eslint-config-synatic-node/lib/jest

Keywords

FAQs

Package last updated on 05 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

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