Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
feat(plugin): updated and simplified settings to use new 0.6.0 APIs
Browse files Browse the repository at this point in the history
Implemented husky, commitizen, and lint-staged for smoother deployments and cleaner commits

BREAKING CHANGE: No longer uses the old settings apis
fix #20, fix #7
  • Loading branch information
brendonscript committed Feb 21, 2022
1 parent 4f644d4 commit 9bf8d69
Show file tree
Hide file tree
Showing 17 changed files with 1,417 additions and 351 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
dist
release.config.js
tailwind.config.js
tailwind.config.js
*.css
85 changes: 81 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,94 @@
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"prettier"
],
"plugins": [
"@typescript-eslint",
"react-hooks",
"simple-import-sort",
"unused-imports"
],
"plugins": ["@typescript-eslint", "react-hooks"],
"parser": "@typescript-eslint/parser",
"rules": {
"no-unused-vars": "warn",
"react/display-name": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"import/prefer-default-export": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-module-boundary-types": "off"
"@typescript-eslint/explicit-module-boundary-types": "off",
//#region //*=========== Unused Import ===========
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "warn",
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_",
}
],
"react/jsx-curly-brace-presence": [
"error",
{
"props": "always",
"children": "alyways"
}
],
//#endregion //*======== Unused Import ===========
//#region //*=========== Import Sort ===========
"simple-import-sort/exports": "warn",
"simple-import-sort/imports": [
"warn",
{
"groups": [
// ext library & side effect imports
[
"^@?\\w",
"^\\u0000"
], // {s}css files
[
"^.+\\.s?css$"
], // Lib and hooks
[
"^@/lib",
"^@/hooks"
], // static data
[
"^@/data"
], // components
[
"^@/components",
"^@/container"
], // zustand store
[
"^@/store"
], // Other imports
[
"^@/"
], // relative paths up until 3 level
[
"^\\./?$",
"^\\.(?!/?$)",
"^\\.\\./?$",
"^\\.\\.(?!/?$)",
"^\\.\\./\\.\\./?$",
"^\\.\\./\\.\\.(?!/?$)",
"^\\.\\./\\.\\./\\.\\./?$",
"^\\.\\./\\.\\./\\.\\.(?!/?$)",
],
[
"^@/types"
], // other that didnt fit in
[
"^"
]
]
}
] //#endregion //*======== Import Sort ===========
}
}
}
150 changes: 149 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,149 @@
module.exports = {extends: ['@commitlint/config-conventional']}
/** @type {import('@commitlint/config-conventional')} */
// eslint-disable-next-line no-undef
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [2, 'always', ['logseq', 'plugin', 'gh']],
'type-enum': [
2,
'always',
[
'build',
'feat',
'fix',
'docs',
'chore',
'style',
'refactor',
'ci',
'test',
'perf',
'revert',
],
],
},
prompt: {
settings: {},
messages: {
skip: ':skip',
max: 'upper %d chars',
min: '%d chars at least',
emptyWarning: 'can not be empty',
upperLimitWarning: 'over limit',
lowerLimitWarning: 'below limit',
},
questions: {
type: {
description: "Select the type of change that you're committing:",
enum: {
feat: {
description: 'A new feature',
title: 'Features',
emoji: '✨',
},
fix: {
description: 'A bug fix',
title: 'Bug Fixes',
emoji: '🐛',
},
docs: {
description: 'Documentation only changes',
title: 'Documentation',
emoji: '📚',
},
style: {
description:
'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
title: 'Styles',
emoji: '💎',
},
refactor: {
description:
'A code change that neither fixes a bug nor adds a feature',
title: 'Code Refactoring',
emoji: '📦',
},
perf: {
description: 'A code change that improves performance',
title: 'Performance Improvements',
emoji: '🚀',
},
test: {
description: 'Adding missing tests or correcting existing tests',
title: 'Tests',
emoji: '🚨',
},
build: {
description:
'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
title: 'Builds',
emoji: '🛠',
},
ci: {
description:
'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
title: 'Continuous Integrations',
emoji: '⚙️',
},
chore: {
description: "Other changes that don't modify src or test files",
title: 'Chores',
emoji: '♻️',
},
revert: {
description: 'Reverts a previous commit',
title: 'Reverts',
emoji: '🗑',
},
},
},
scope: {
description: 'What is the scope of this change',
enum: {
client: {
description: 'Frontend related',
title: 'Client',
emoji: '🎨',
},
server: {
description: 'Backend related',
title: 'Server',
emoji: '💻',
},
db: {
description: 'Database related',
title: 'Database',
emoji: '🗃',
},
},
},
subject: {
description:
'Write a short, imperative tense description of the change',
},
body: {
description: 'Provide a longer description of the change',
},
isBreaking: {
description: 'Are there any breaking changes?',
},
breakingBody: {
description:
'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself',
},
breaking: {
description: 'Describe the breaking changes',
},
isIssueAffected: {
description: 'Does this change affect any open issues?',
},
issuesBody: {
description:
'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself',
},
issues: {
description: 'Add issue references (e.g. "fix #123", "re #123".)',
},
},
},
}
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
"name": "logseq-plugin-periodic-notes",
"version": "1.0.0",
"scripts": {
"commit": "git-cz",
"dev": "cross-env browser=none vite",
"dev:css": "npx tailwindcss -i .\\src\\tailwind-base.css -o .\\src\\tailwind.css --watch",
"lint:fix": "eslint src --fix && pnpm format",
"lint:strict": "eslint --quiet src",
"format": "prettier -w ./src",
"format:check": "prettier -c .",
"prepare": "husky install",
"typecheck": "tsc --noEmit --incremental false",
"preview": "vite preview",
"build": "tsc && vite build"
},
Expand All @@ -21,6 +28,7 @@
"devDependencies": {
"@commitlint/cli": "16.2.1",
"@commitlint/config-conventional": "16.2.1",
"@commitlint/cz-commitlint": "^16.2.1",
"@semantic-release/changelog": "6.0.1",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
Expand All @@ -33,19 +41,36 @@
"@typescript-eslint/parser": "5.12.0",
"@vitejs/plugin-react": "1.2.0",
"@vitejs/plugin-react-refresh": "1.3.6",
"commitizen": "^4.0.3",
"conventional-changelog-conventionalcommits": "4.6.3",
"cross-env": "7.0.3",
"eslint": "8.9.0",
"eslint-config-prettier": "^8.4.0",
"eslint-plugin-react": "7.28.0",
"eslint-plugin-react-hooks": "4.3.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "7.0.4",
"inquirer": "^8.0.0",
"lint-staged": "^12.3.4",
"prettier": "^2.5.1",
"semantic-release": "19.0.2",
"typescript": "4.5.5",
"vite": "2.8.4"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,}": [
"eslint --quiet",
"prettier -w"
]
},
"logseq": {
"id": "_brendon-michael-logseq-periodic-notes",
"icon": "./logo.svg",
"settingsVersion": "0.0.1"
},
"peerDependencies": {
"commitizen": "^4.0.3",
"inquirer": "^8.0.0"
}
}

0 comments on commit 9bf8d69

Please sign in to comment.