0.0.3 • Published 2 years ago

@avayler/eslint-config v0.0.3

Weekly downloads
-
License
GPL-3.0-or-later
Repository
-
Last release
2 years ago

@Avayler/eslint-config

Repository containing the tools for code formatting and code quality agreed within the Avayler team.

It includes:

  • ESLint's configuration file for apps written in JavaScript/TypeScript that use either React or Next
  • Prettier configuration file that voids the conflicting ESLint rules

Publishing the package

Initial configuration to be able to publish the package

Read and follow this link.

To summarize:

  1. Add the following to our user's .npmrc (under the $HOME variable):
; begin auth token 
//pkgs.dev.azure.com/Avayler-SaaS/_packaging/SaaS-Artifacts/npm/registry/:username=Avayler-SaaS 
//pkgs.dev.azure.com/Avayler-SaaS/_packaging/SaaS-Artifacts/npm/registry/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN] 
//pkgs.dev.azure.com/Avayler-SaaS/_packaging/SaaS-Artifacts/npm/registry/:email=npm requires email to be set but doesn't use the value
//pkgs.dev.azure.com/Avayler-SaaS/_packaging/SaaS-Artifacts/npm/:username=Avayler-SaaS 
//pkgs.dev.azure.com/Avayler-SaaS/_packaging/SaaS-Artifacts/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN] 
//pkgs.dev.azure.com/Avayler-SaaS/_packaging/SaaS-Artifacts/npm/:email=npm requires email to be set but doesn't use the value
; end auth token
  1. Generate a personal access token here with packaging R&W permissions
  2. Run node -e "require('readline') .createInterface({input:process.stdin,output:process.stdout,historySize:0}) .question('PAT> ',p => { b64=Buffer.from(p.trim()).toString('base64');console.log(b64);process.exit(); })", paste the personal access token from the previous step, press Enter and copy the value returned.
  3. Replace [BASE64_ENCODED_PERSONAL_ACCESS_TOKEN] with the copied value in our .npmrc

Publish new changes in the package

// TODO: This should be automated in a release pipeline We will have to create a PR from a branch, making sure we increase the package version. Once merged, we can run npm publish from the main branch to publish our new changes.

How to

To make use of the ESLint configuration we should just extend it from our own eslintrc.json file as follows:

{
  "extends": [
    "@avayler/eslint-config"
  ],
  "rules": {
    // ... Re-declare any specific rules for the project
    // Ideally these would be centralized, so we shouldn't be using it that often
  }
}

// TODO: Add husky pre-commit