Skip to content

Commit

Permalink
feat!: use perfectionist (#70)
Browse files Browse the repository at this point in the history
* feat!: use perfectionist

BREAKING CHANGES: use perfectionist, remove various disabled rules

* chore: linting
  • Loading branch information
mdonnalley authored Oct 9, 2023
1 parent 7dad82d commit 04543dc
Show file tree
Hide file tree
Showing 14 changed files with 195 additions and 106 deletions.
7 changes: 7 additions & 0 deletions .git2gus/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"productTag": "a1aB0000000ce2IIAQ",
"defaultBuild": "offcore.tooling.59",
"issueTypeLabels": { "enhancement": "USER STORY", "bug": "BUG P3" },
"hideWorkItemUrl": true,
"statusWhenClosed": "CLOSED"
}
7 changes: 4 additions & 3 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: automerge
on:
workflow_dispatch:
schedule:
- cron: '17 2,5,8,11 * * *'
- cron: "42 2,5,8,11 * * *"

jobs:
automerge:
uses: oclif/github-workflows/.github/workflows/automerge.yml@main
secrets: inherit
uses: salesforcecli/github-workflows/.github/workflows/automerge.yml@main
secrets:
SVC_CLI_BOT_GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
with:
mergeMethod: squash
28 changes: 28 additions & 0 deletions .github/workflows/create-github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: create-github-release

on:
push:
branches:
- main
# point at specific branches, or a naming convention via wildcard
- prerelease/**
tags-ignore:
- '*'
workflow_dispatch:
inputs:
prerelease:
type: string
description: 'Name to use for the prerelease: beta, dev, etc. NOTE: If this is already set in the package.json, it does not need to be passed in here.'

jobs:
release:
# this job will throw if prerelease is true but it doesn't have a prerelease-looking package.json version
uses: salesforcecli/github-workflows/.github/workflows/create-github-release.yml@main
secrets:
SVC_CLI_BOT_GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
with:
prerelease: ${{ inputs.prerelease }}
# If this is a push event, we want to skip the release if there are no semantic commits
# However, if this is a manual release (workflow_dispatch), then we want to disable skip-on-empty
# This helps recover from forgetting to add semantic commits ('fix:', 'feat:', etc.)
skip-on-empty: ${{ github.event_name == 'push' }}
2 changes: 1 addition & 1 deletion .github/workflows/failureNotifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: failureNotifications
on:
workflow_run:
workflows:
- version, tag and github release
- create-github-release
- publish
types:
- completed
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/manualRelease.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/onPushToMain.yml

This file was deleted.

22 changes: 18 additions & 4 deletions .github/workflows/onRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: publish

on:
release:
types: [released]
types: [published]
# support manual release in case something goes wrong and needs to be repeated or tested
workflow_dispatch:
inputs:
Expand All @@ -11,9 +11,23 @@ on:
type: string
required: true
jobs:
# parses the package.json version and detects prerelease tag (ex: beta from 4.4.4-beta.0)
getDistTag:
outputs:
tag: ${{ steps.distTag.outputs.tag }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
- uses: salesforcecli/github-workflows/.github/actions/getPreReleaseTag@main
id: distTag

npm:
uses: oclif/github-workflows/.github/workflows/npmPublish.yml@main
uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main
needs: [getDistTag]
with:
tag: latest
tag: ${{ needs.getDistTag.outputs.tag || 'latest' }}
githubTag: ${{ github.event.release.tag_name || inputs.tag }}
secrets: inherit
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ on:
workflow_dispatch:

jobs:
unit-tests:
uses: oclif/github-workflows/.github/workflows/unitTest.yml@main
yarn-lockfile-check:
uses: salesforcecli/github-workflows/.github/workflows/lockFileCheck.yml@main
linux-unit-tests:
needs: yarn-lockfile-check
uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@oclif/prettier-config"
5 changes: 0 additions & 5 deletions .releaserc

This file was deleted.

4 changes: 0 additions & 4 deletions git2gus/config.json

This file was deleted.

78 changes: 47 additions & 31 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,56 @@
module.exports = {
extends: [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:node/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:node/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:perfectionist/recommended-natural',
],
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'import'],
rules: {
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": [
"error",
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-var-requires': 'off',
'import/no-unresolved': 'error',
'no-unused-expressions': 'off',
'node/no-missing-import': 'off',
'node/no-unsupported-features/es-syntax': 'off',
'perfectionist/sort-classes': [
'error',
{
"argsIgnorePattern": "^_"
}
groups: [
'index-signature',
'static-property',
'property',
'private-property',
'constructor',
'static-method',
'static-private-method',
['get-method', 'set-method'],
'method',
'private-method',
'unknown',
],
order: 'asc',
type: 'alphabetical',
},
],
"@typescript-eslint/no-var-requires": "off",
"no-unused-expressions": "off",
"node/no-unsupported-features/es-syntax": "off",
"node/no-missing-import": "off",
"import/no-unresolved": "error",
"valid-jsdoc": ["warn", { "requireReturnType": false, "requireParamType": false }]
}
'valid-jsdoc': ['warn', {requireParamType: false, requireReturnType: false}],
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
},
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-node": "^11.1.0"
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-perfectionist": "^2.1.0"
},
"devDependencies": {
"@oclif/prettier-config": "^0.2.1",
"eslint": "^8.49.0",
"typescript": "^4.9.5"
},
Expand All @@ -34,4 +36,4 @@
"test": "eslint -c index.js .",
"build": "echo 'nothing to build!'"
}
}
}
Loading

0 comments on commit 04543dc

Please sign in to comment.