Skip to content

Commit

Permalink
fix(eslint-config): refactor repo
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenykruglikov committed Sep 26, 2024
1 parent 74fb3cb commit 7649487
Show file tree
Hide file tree
Showing 36 changed files with 9,451 additions and 13,191 deletions.
11 changes: 11 additions & 0 deletions .autorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": [
[
"npm",
{
"setRcToken": false
}
],
"./format-before-commit.js"
]
}
17 changes: 10 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
if: (!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci'))
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_REGISTRY_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Prepare repository
run: git fetch --unshallow --tags
Expand All @@ -26,13 +26,13 @@ jobs:
# https://github.com/intuit/auto/issues/1030
run: git config --local --unset http.https://github.com/.extraheader

- name: Use Node.js 20.x
uses: actions/setup-node@v1
- name: Use Node.js 20.x LTS
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version-file: '.nvmrc'

- name: Cache node modules
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: node_modules
key: npm-deps-${{ hashFiles('package-lock.json') }}
Expand All @@ -43,9 +43,12 @@ jobs:
run: |
npm ci
- name: Test
run: |
npm run test
- name: Release Info
run: npm whoami && npx auto info || echo 'auto info returned 1'

- name: Create Release
run: npm run release

2 changes: 1 addition & 1 deletion .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Semgrep

on:
pull_request:
branches: ["master"]
branches: ['master']

permissions:
actions: read
Expand Down
1 change: 0 additions & 1 deletion .husky/commit-msg

This file was deleted.

1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

15 changes: 3 additions & 12 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"*.{js,jsx,ts,tsx}": [
"prettier --write"
],
"*.md": [
"prettier --write --parser markdown",
"git add"
],
"*.json": [
"prettier --write --parser json",
"node",
"git add"
]
"*.{js,jsx,ts,tsx}": ["prettier --write"],
"*.md": ["prettier --write --parser markdown", "git add"],
"*.json": ["prettier --write --parser json", "node", "git add"]
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.5.1
v20.17.0
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
node_modules
lerna.json
package.json
package-lock.json
11 changes: 10 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
parser: 'typescript',
arrowParens: 'always',
printWidth: 120,
bracketSameLine: false,
Expand All @@ -9,4 +8,14 @@ module.exports = {
singleQuote: true,
tabWidth: 4,
trailingComma: 'all',
useTabs: false,
overrides: [
{
files: '*.{json,md,yaml,yml}',
options: {
tabWidth: 2,
},
},
],
plugins: ['prettier-plugin-packagejson'],
};
20 changes: 10 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@

- `@salutejs/[email protected]`
- feat(eslint-config): add new rule prefer-lazy-state-initialization [#35](https://github.com/salute-developers/grail/pull/35) ([@SeanSilke](https://github.com/SeanSilke))
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat: custom rule no redundant commit [#25](https://github.com/salute-developers/grail/pull/25) ([@KateKate](https://github.com/KateKate) [@SeanSilke](https://github.com/SeanSilke))

#### 🐛 Bug Fix

- fix: update auto [#36](https://github.com/salute-developers/grail/pull/36) ([@SeanSilke](https://github.com/SeanSilke))
- `@salutejs/[email protected]`
- fix(eslint-config): disabled jsx-no-leaked-render [#34](https://github.com/salute-developers/grail/pull/34) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): add nesting awareness for no-redundant-commit rule [#31](https://github.com/salute-developers/grail/pull/31) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): add nesting awareness for no-redundant-commit rule [#31](https://github.com/salute-developers/grail/pull/31) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): changed the autofix option for jsx-no-leaked-render [#30](https://github.com/salute-developers/grail/pull/30) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): fixed typo and replaced link with shorter one [#28](https://github.com/salute-developers/grail/pull/28) ([@SeanSilke](https://github.com/SeanSilke))
- ci: add prettierc.js, fix package-lock [#26](https://github.com/salute-developers/grail/pull/26) ([@KateKate](https://github.com/KateKate))
Expand All @@ -100,14 +100,14 @@
#### 🚀 Enhancement

- `@salutejs/[email protected]`
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat: custom rule no redundant commit [#25](https://github.com/salute-developers/grail/pull/25) ([@KateKate](https://github.com/KateKate) [@SeanSilke](https://github.com/SeanSilke))

#### 🐛 Bug Fix

- `@salutejs/[email protected]`
- fix(eslint-config): disabled jsx-no-leaked-render [#34](https://github.com/salute-developers/grail/pull/34) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): add nesting awareness for no-redundant-commit rule [#31](https://github.com/salute-developers/grail/pull/31) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): add nesting awareness for no-redundant-commit rule [#31](https://github.com/salute-developers/grail/pull/31) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): changed the autofix option for jsx-no-leaked-render [#30](https://github.com/salute-developers/grail/pull/30) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): fixed typo and replaced link with shorter one [#28](https://github.com/salute-developers/grail/pull/28) ([@SeanSilke](https://github.com/SeanSilke))
- ci: add prettierc.js, fix package-lock [#26](https://github.com/salute-developers/grail/pull/26) ([@KateKate](https://github.com/KateKate))
Expand All @@ -130,15 +130,15 @@
#### 🚀 Enhancement

- `@salutejs/[email protected]`
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat: custom rule no redundant commit [#25](https://github.com/salute-developers/grail/pull/25) ([@KateKate](https://github.com/KateKate) [@SeanSilke](https://github.com/SeanSilke))

#### 🐛 Bug Fix

- `@salutejs/[email protected]`
- fix: removed legacy-peer-deps [#33](https://github.com/salute-developers/grail/pull/33) ([@SeanSilke](https://github.com/SeanSilke))
- `@salutejs/[email protected]`
- fix(eslint-config): add nesting awareness for no-redundant-commit rule [#31](https://github.com/salute-developers/grail/pull/31) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): add nesting awareness for no-redundant-commit rule [#31](https://github.com/salute-developers/grail/pull/31) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): changed the autofix option for jsx-no-leaked-render [#30](https://github.com/salute-developers/grail/pull/30) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): fixed typo and replaced link with shorter one [#28](https://github.com/salute-developers/grail/pull/28) ([@SeanSilke](https://github.com/SeanSilke))
- ci: add prettierc.js, fix package-lock [#26](https://github.com/salute-developers/grail/pull/26) ([@KateKate](https://github.com/KateKate))
Expand All @@ -159,13 +159,13 @@
#### 🚀 Enhancement

- `@salutejs/[email protected]`
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat: custom rule no redundant commit [#25](https://github.com/salute-developers/grail/pull/25) ([@KateKate](https://github.com/KateKate) [@SeanSilke](https://github.com/SeanSilke))

#### 🐛 Bug Fix

- `@salutejs/[email protected]`
- fix(eslint-config): add nesting awareness for no-redundant-commit rule [#31](https://github.com/salute-developers/grail/pull/31) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): add nesting awareness for no-redundant-commit rule [#31](https://github.com/salute-developers/grail/pull/31) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): changed the autofix option for jsx-no-leaked-render [#30](https://github.com/salute-developers/grail/pull/30) ([@SeanSilke](https://github.com/SeanSilke))
- fix(eslint-config): fixed typo and replaced link with shorter one [#28](https://github.com/salute-developers/grail/pull/28) ([@SeanSilke](https://github.com/SeanSilke))
- ci: add prettierc.js, fix package-lock [#26](https://github.com/salute-developers/grail/pull/26) ([@KateKate](https://github.com/KateKate))
Expand All @@ -186,7 +186,7 @@
#### 🚀 Enhancement

- `@salutejs/[email protected]`
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat: custom rule no redundant commit [#25](https://github.com/salute-developers/grail/pull/25) ([@KateKate](https://github.com/KateKate) [@SeanSilke](https://github.com/SeanSilke))

#### 🐛 Bug Fix
Expand All @@ -212,7 +212,7 @@
#### 🚀 Enhancement

- `@salutejs/[email protected]`
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat(eslint-config): added `Do not memoize primitives` as a full-fledged rule [#29](https://github.com/salute-developers/grail/pull/29) ([@SeanSilke](https://github.com/SeanSilke))
- feat: custom rule no redundant commit [#25](https://github.com/salute-developers/grail/pull/25) ([@KateKate](https://github.com/KateKate) [@SeanSilke](https://github.com/SeanSilke))

#### 🐛 Bug Fix
Expand Down
29 changes: 29 additions & 0 deletions format-before-commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = class TestPlugin {
constructor() {
this.name = 'format-before-commit';
}

/**
* Tap into auto plugin points.
* @param {import('@auto-it/core').default} auto
*/
apply(auto) {
auto.hooks.beforeCommitChangelog.tapAsync('FormatBeforeCommit', async () => {
const { exec } = require('child_process');
const { promisify } = require('util');

const execAsync = promisify(exec);

const { stderr, stdout } = await execAsync('npm run fmt');

if (stderr) {
console.error(stderr);
process.exit(1);
}

if (stdout) {
console.log(stdout);
}
});
}
};
21 changes: 2 additions & 19 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
{
"$schema": "./node_modules/lerna/schemas/lerna-schema.json",
"version": "independent",
"ignoreChanges": ["*.md"],
"loglevel": "verbose",
"exact": true,
"ci": true,
"command": {
"bootstrap": {
"npmClientArgs": [
"--no-audit",
"--no-optional",
"--loglevel error",
"--no-progress",
"--unsafe-perm",
"--prefer-offline"
]
},
"publish": {
"verifyAccess": false
}
}
"packages": ["packages/*"]
}
Loading

0 comments on commit 7649487

Please sign in to comment.