Skip to content

Commit

Permalink
🩹 (config) NICE-54 eslint|lint-staged|prettiier upgrades [b] (#1133)
Browse files Browse the repository at this point in the history
**Update:**

- [x] 🩹  (eslint) NICE-54 package upgrades
- [x] 🩹   (lint-staged) NICE-54 add micromatch; root package improve
  - Eh, customized rules -- again -- if you are using this you are probably creating your own something not using these
- [x] 🩹  (prettier): NICE-54 remove pretty-quick; package root improve

**Add:**

- [x] ~~TBD: lighthouse-config~~
- [x] ~~TBD: next-config~~
- [x] ~~TBD: playwright-config~~
- [x] ~~TBD: storybook-config~~
- [x] ~~TBD: tailwind-config~~

**Pause:**

- [x] ⏸️  (config) NICE-54 jest-config
- [x] ⏸️  (config) NICE-54 jest-presets
- [x] ⏸️ everything why am i not outside enjoying the day
  • Loading branch information
JeromeFitz authored Jul 6, 2023
1 parent f19767e commit 6069d52
Show file tree
Hide file tree
Showing 32 changed files with 524 additions and 288 deletions.
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# @note(husky) 🚩 Feature Flags: Opt-out by setting to 0
HUSKY__PRE_COMMIT__FORMAT=1
HUSKY__PRE_COMMIT__LINT=1
HUSKY__PRE_COMMIT__LINT_STAGED=1
HUSKY__PREPARE_COMMITMSG__CONVENTIONAL=1
3 changes: 1 addition & 2 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"@babel/eslint-parser",
"@typescript-eslint/eslint-plugin",
"@typescript-eslint/parser",
"prettier",
"pretty-quick"
"prettier"
],
"matchPackagePatterns": ["^eslint"]
},
Expand Down
10 changes: 3 additions & 7 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ fi
# shellcheck disable=SC2009
if ps -o args= $PPID | grep -E -q ' --no-verify| -n | -n$' ; then
exit 0
elif [ "$HUSKY" = "0" ]; then
exit 0
elif [[ "$HUSKY__PRE_COMMIT__FORMAT" = "0" && "$HUSKY__PRE_COMMIT__LINT" = "0" ]]; then
exit 0
fi

if [ ! "$HUSKY__PRE_COMMIT__FORMAT" = "0" ]; then
pnpm pretty-quick --staged
if [ "$HUSKY" = "0" ]; then
exit 0
fi

if [ ! "$HUSKY__PRE_COMMIT__LINT" = "0" ]; then
if [ ! "$HUSKY__PRE_COMMIT__LINT_STAGED" = "0" ]; then
pnpm lint-staged
fi
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public-hoist-pattern[]=*ccommit*
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*lint-staged*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=*pretty-quick*
# typescript
public-hoist-pattern[]=*types*
# storybook
Expand Down
8 changes: 4 additions & 4 deletions config/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
"eslint-config-turbo": "1.9.3",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jest": "27.2.1",
"eslint-plugin-jest-dom": "4.0.3",
"eslint-plugin-jest-dom": "5.0.1",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-playwright": "0.12.0",
"eslint-plugin-playwright": "0.15.3",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-storybook": "0.6.11",
"eslint-plugin-storybook": "0.6.12",
"eslint-plugin-tailwindcss": "3.12.0",
"eslint-plugin-testing-library": "5.10.3",
"eslint-plugin-testing-library": "5.11.0",
"eslint-plugin-turbo": "1.9.3",
"eslint-plugin-typescript-sort-keys": "2.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion config/eslint-config/release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { name } = require('./package.json')

const branches = [
...configDefault.branches,
{ name: 'feat/config-canary', prerelease: 'canary' },
{ name: 'refactor/NICE-54', prerelease: 'canary' },
]

const configPassed = {
Expand Down
1 change: 1 addition & 0 deletions config/jest-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# in-progress
46 changes: 46 additions & 0 deletions config/jest-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@jeromefitz/jest-config",
"version": "0.0.0",
"type": "commonjs",
"description": "Jest Configuration",
"repository": "jeromefitz/packages.git",
"author": {
"name": "Jerome Fitzgerald",
"email": "[email protected]",
"url": "https://jeromefitzgerald.com"
},
"license": "MIT",
"private": false,
"engines": {
"node": ">=16"
},
"scripts": {
"build": "pnpm run clean && pnpm run copy",
"clean": "rm -rf .turbo && rm -rf dist",
"clean:install": "pnpm run clean && rm -rf node_modules",
"copy": "mkdir -p ./dist && ./scripts/copy.sh",
"semantic-release": "semantic-release"
},
"peerDependencies": {
"@jeromefitz/jest-presets": "^1.0.0",
"next": "^13.3.3"
},
"dependencies": {
"@testing-library/dom": "9.3.1",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
"@types/jest": "29.5.2",
"@types/testing-library__jest-dom": "5.14.7",
"jest": "29.6.0",
"jest-environment-jsdom": "29.6.1"
},
"devDependencies": {
"@jeromefitz/jest-presets": "workspace:*",
"next": "13.3.3"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"sideEffects": false
}
23 changes: 23 additions & 0 deletions config/jest-config/release.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable import/order */
const isCI = require('is-ci')
!isCI && require('dotenv').config({ path: '../../.env' })

const { config: configDefault } = require('../../release.config.cjs')
const { getConfig } = require('@jeromefitz/semantic')

const { name } = require('./package.json')

const branches = [
...configDefault.branches,
{ name: 'refactor/NICE-54', prerelease: 'canary' },
]

const configPassed = {
...configDefault,
branches,
tagFormat: `${name}@\${version}`,
}

const config = getConfig(configPassed)

module.exports = config
40 changes: 40 additions & 0 deletions config/jest-config/scripts/copy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

###
# @note(build): NPM Publishes from `./dist`
###

cp package.json ./dist/
cp README.md ./dist/
cp ../../LICENSE ./dist/

###
# @note(build): Replace `dist/index` w/ `index`
###
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s|dist/index|index|g" dist/package.json
else
sed -i -e "s|dist/index|index|g" dist/package.json
fi
else
sed -i -e "s|dist/index|index|g" dist/package.json
fi

###
# @custom(build) jest
###

cp ./src/* ./dist

if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s|src/index|index|g" dist/package.json
else
sed -i -e "s|src/index|index|g" dist/package.json
fi

if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s|jest-presets/src/jest|jest-presets/jest|g" dist/jest.config.js
else
sed -i -e "s|jest-presets/src/jest|jest-presets/jest|g" dist/jest.config.js
fi
15 changes: 15 additions & 0 deletions config/jest-config/src/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const jestNode = require('@jeromefitz/jest-presets/jest/node/jest-preset')
const jestNext = require('next/jest')

/** @type {import('jest').Config} */
const config = {
coverageReporters: ['text', 'html'],
// preset: '@jeromefitz/jest-presets/jest/node',
setupFilesAfterEnv: ['@jeromefitz/jest-config/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
watchman: false,
...jestNode,
}

const defineConfig = jestNext({ dir: './' })
module.exports = defineConfig(config)
1 change: 1 addition & 0 deletions config/jest-config/src/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom/extend-expect'
1 change: 1 addition & 0 deletions config/jest-presets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# in-progress
28 changes: 28 additions & 0 deletions config/jest-presets/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@jeromefitz/jest-presets",
"version": "0.0.0",
"type": "commonjs",
"description": "Jest Presets Configuration",
"repository": "jeromefitz/packages.git",
"author": {
"name": "Jerome Fitzgerald",
"email": "[email protected]",
"url": "https://jeromefitzgerald.com"
},
"license": "MIT",
"private": false,
"engines": {
"node": ">=16"
},
"main": "./src/jest/node/jest-preset.js",
"scripts": {
"build": "pnpm run clean && pnpm run copy",
"clean": "rm -rf .turbo && rm -rf dist",
"clean:install": "pnpm run clean && rm -rf node_modules",
"copy": "mkdir -p ./dist && ./scripts/copy.sh",
"semantic-release": "semantic-release"
},
"dependencies": {
"ts-jest": "29.1.1"
}
}
23 changes: 23 additions & 0 deletions config/jest-presets/release.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable import/order */
const isCI = require('is-ci')
!isCI && require('dotenv').config({ path: '../../.env' })

const { config: configDefault } = require('../../release.config.cjs')
const { getConfig } = require('@jeromefitz/semantic')

const { name } = require('./package.json')

const branches = [
...configDefault.branches,
{ name: 'refactor/NICE-54', prerelease: 'canary' },
]

const configPassed = {
...configDefault,
branches,
tagFormat: `${name}@\${version}`,
}

const config = getConfig(configPassed)

module.exports = config
41 changes: 41 additions & 0 deletions config/jest-presets/scripts/copy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

###
# @note(build): NPM Publishes from `./dist`
###

cp package.json ./dist/
cp README.md ./dist/
cp ../../LICENSE ./dist/

###
# @note(build): Replace `dist/index` w/ `index`
###
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s|dist/index|index|g" dist/package.json
else
sed -i -e "s|dist/index|index|g" dist/package.json
fi
else
sed -i -e "s|dist/index|index|g" dist/package.json
fi

###
# @custom(build) jest-presets
###

mkdir -p ./dist/jest/node
cp ./src/jest/node/* ./dist/jest/node

if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s|src/index|index|g" dist/package.json
else
sed -i -e "s|src/index|index|g" dist/package.json
fi

if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s|src/jest|jest|g" dist/package.json
else
sed -i -e "s|src/jest|jest|g" dist/package.json
fi
13 changes: 13 additions & 0 deletions config/jest-presets/src/jest/node/jest-preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
roots: ['<rootDir>'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
modulePathIgnorePatterns: [
'<rootDir>/test/__fixtures__',
'<rootDir>/node_modules',
'<rootDir>/dist',
],
preset: 'ts-jest',
}
1 change: 1 addition & 0 deletions config/lighthouse-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# in-progress
31 changes: 31 additions & 0 deletions config/lighthouse-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@jeromefitz/lighthouse-config",
"version": "0.0.0",
"type": "module",
"description": "Lighthouse Configuration",
"repository": "jeromefitz/packages.git",
"author": {
"name": "Jerome Fitzgerald",
"email": "[email protected]",
"url": "https://jeromefitzgerald.com"
},
"license": "MIT",
"private": false,
"engines": {
"node": ">=16"
},
"main": "./src/lighthouse.config.cjs",
"module": "./src/lighthouse.config.cjs",
"scripts": {
"build": "pnpm run clean && pnpm run copy",
"clean": "rm -rf .turbo && rm -rf dist",
"clean:install": "pnpm run clean && rm -rf node_modules",
"copy": "mkdir -p ./dist && ./scripts/copy.sh",
"dev": "echo '# tsup-node --watch'",
"format:lint": "pnpm run lint:eslint --fix && pnpm run format:prettier --write",
"format:prettier": "prettier \"./src/**/*.{cjs,js,jsx,mjs,ts,tsx,json,md,mdx,css,html,yml,yaml,scss}\" --ignore-unknown --loglevel warn",
"lint": "pnpm run format:prettier --check && pnpm run lint:eslint",
"lint:eslint": "eslint ./src --ext cjs,js,jsx,mjs,ts,tsx --max-warnings=0",
"semantic-release": "semantic-release"
}
}
23 changes: 23 additions & 0 deletions config/lighthouse-config/release.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable import/order */
const isCI = require('is-ci')
!isCI && require('dotenv').config({ path: '../../.env' })

const { config: configDefault } = require('../../release.config.cjs')
const { getConfig } = require('@jeromefitz/semantic')

const { name } = require('./package.json')

const branches = [
...configDefault.branches,
{ name: 'refactor/NICE-54', prerelease: 'canary' },
]

const configPassed = {
...configDefault,
branches,
tagFormat: `${name}@\${version}`,
}

const config = getConfig(configPassed)

module.exports = config
Loading

0 comments on commit 6069d52

Please sign in to comment.