Skip to content

Commit

Permalink
Merge pull request #1 from jacob-8/update-kitbook
Browse files Browse the repository at this point in the history
update dependencies
  • Loading branch information
jacob-8 authored Apr 24, 2024
2 parents e34fd01 + 530b47e commit cb464dc
Show file tree
Hide file tree
Showing 88 changed files with 5,054 additions and 2,091 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Lint changes

on:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8.6.0

- uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- run: pnpm install

- name: Run ESLint on changed files
uses: tj-actions/eslint-changed-files@v24
with:
config_path: eslint.config.js
file_extensions: |
**/*.ts
**/*.js
**/*.svelte
**/*.composition
**/*.html
**/*.markdown
**/*.json
**/*.yml
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ jobs:
cache: pnpm
registry-url: 'https://registry.npmjs.org'

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Install Dependencies
run: pnpm i

Expand All @@ -43,3 +39,7 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
name: Lint, Svelte Check, & Unit Test Push
name: Svelte Check, & Unit Test Push

on:
push:
branches:
- '**'

jobs:
# lint:
# name: Lint
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3

# - uses: pnpm/action-setup@v2
# with:
# version: 8.6.0

# - uses: actions/setup-node@v3
# with:
# node-version: 18
# cache: pnpm

# - run: pnpm install

# - name: Lint
# run: pnpm lint

unit_test:
name: Svelte Check & Unit Test
runs-on: ubuntu-latest
Expand All @@ -45,7 +25,7 @@ jobs:
- run: pnpm install
- run: pnpm sync
- run: pnpm check

- name: Run Vitest Unit Tests
run: pnpm test

Expand Down
27 changes: 18 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,46 @@
"titleBar.activeBackground": "#ff400089",
"titleBar.inactiveBackground": "#ff3e0069",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveForeground": "#e7e7e799"
"titleBar.inactiveForeground": "#e7e7e799",
},

// Kitbook
"files.associations": {
"*.composition": "svelte"
"*.composition": "svelte",
},
"foam.completion.label": "title",
"foam.edit.linkReferenceDefinitions": "withExtensions",
"foam.files.ignore": [
"**/node_modules/**/*",
"**/.svelte-kit/**/*",
"**/dist/**/*"
"**/dist/**/*",
],
"foam.completion.label": "title",
"foam.files.notesExtensions": "composition",

// ES Lint
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
"source.organizeImports": "never",
},
// Silence the stylistic rules in your IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "@stylistic/*", "severity": "off" },
{ "rule": "style*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
{ "rule": "*semi", "severity": "off" },
{ "rule": "import/newline-after-import", "severity": "off" },
{ "rule": "import/order", "severity": "off" },
{ "rule": "sort-imports", "severity": "off" },
{ "rule": "ts/no-empty-function", "severity": "off" },
],
"eslint.validate": [
"javascript",
Expand All @@ -43,9 +52,9 @@
"svelte",
"json",
"jsonc",
"yaml"
"yaml",
],
"eslint.experimental.useFlatConfig": true,

"svelte.plugin.svelte.compilerWarnings": {
"a11y-click-events-have-key-events": "ignore",
"a11y-aria-attributes": "ignore",
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
<a href="https://www.npmjs.com/package/svelte-pieces"><img src="https://img.shields.io/npm/v/svelte-pieces?color=729B1B&label="></a>
[![code style](https://antfu.me/badge-code-style.svg)](https://github.com/antfu/eslint-config)

[Read the Documentation and try out the components using Kitbook](https://svelte-pieces.vercel.app/)
<!-- Kitbook Skip -->

[Read the Documentation and try out the components using Kitbook](https://svelte-pieces.vercel.app/)

<!-- Kitbook Skip End -->

Built using Kitbook, UnoCSS, and Iconify icons - you don't need UnoCSS installed for these components to work properly as the classes get generated at packaging time by the to [@unocss/svelte-scoped preprocessor](https://unocss.dev/integrations/svelte-scoped#svelte-preprocessor).

## Usage

Expand All @@ -12,4 +18,5 @@

## Contributing

- Start by running `pnpm i`, then `pnpm dev` - feel free to submit a pull request, though I advise creating an issue first to discuss your addition.
- Start by running `pnpm install`, then `pnpm dev` - feel free to submit a pull request, though I advise creating an issue first to discuss your addition.
- We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
162 changes: 162 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
// To run automatically on commit, add `simple-git-hooks` and `lint-staged` then run `npx simple-git-hooks` once. After that all commits will be linted.

// @ts-check
import { antfu } from '@antfu/eslint-config'
import jsEslintPlugin from '@eslint/js'
import tsEslintPlugin from '@typescript-eslint/eslint-plugin'
import svelteStylistic from 'eslint-plugin-svelte-stylistic'

// Inspect: npx @eslint/config-inspector
export default antfu(
{
ignores: [
'**/.svelte-kit**',
'**/functions/lib/**',
'.eslintcache',
'packages/scripts/import/old**',
'**/route/kitbook/**',
'**/locales/**',
'supabase/functions/**',
],
stylistic: {
overrides: {
'style/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'antfu/if-newline': 'off',
'curly': 'off',
},
},
svelte: true,
},
{
name: 'jacob/svelte/stylistic',
files: ['**/*.svelte', '**/*.composition'],
plugins: {
'svelte-stylistic': svelteStylistic,
},
rules: {
'svelte-stylistic/brackets-same-line': 'error',
'svelte-stylistic/consistent-attribute-lines': 'error',
},
},
{
name: 'jacob/test/rules',
files: ['**/*.test.ts'],
rules: {
'test/consistent-test-it': ['error', { fn: 'test' }],
'test/no-commented-out-tests': 'error',
'test/no-disabled-tests': 'error',
'test/consistent-test-filename': 'error',
'test/expect-expect': 'error',
'test/no-alias-methods': 'error',
'test/no-conditional-expect': 'error',
'test/no-conditional-in-test': 'error',
'test/no-conditional-tests': 'error',
'test/no-duplicate-hooks': 'error',
'test/no-focused-tests': 'error',
'test/no-standalone-expect': 'error',
'test/no-test-return-statement': 'error',
'test/prefer-comparison-matcher': 'error',
'test/prefer-hooks-on-top': 'error',
'test/prefer-spy-on': 'error',
'test/prefer-to-be-falsy': 'error',
'test/prefer-to-be-truthy': 'error',
'test/prefer-to-contain': 'error',
'test/prefer-to-have-length': 'error',
'test/valid-describe-callback': 'error',
'test/valid-expect': 'error',
},
},
{
name: 'jacob/settings',
files: ['.vscode/*.json'],
rules: {
'jsonc/comma-dangle': ['error', 'always-multiline'],
},
},
{
name: 'ld/script-exceptions',
files: ['packages/{scripts,functions}/**'],
rules: {
'no-console': 'off',
'ts/no-unused-vars': 'off',
'ts/no-var-requires': 'off',
},
},
{
name: 'ld/intercontinental-dictionaries-series',
files: ['**/ids-import/**'],
rules: {
'ts/no-unused-vars': 'off',
'no-undef': 'off',
},
},
).overrides({
'antfu/typescript/rules': {
files: ['**/*.svelte', '**/*.composition'],
rules: {
...jsEslintPlugin.configs.recommended.rules,
// ...tsEslintPlugin.configs.recommended.rules, // cause the rest to break
...tsEslintPlugin.configs.stylistic.rules,

'prefer-destructuring': 'error',
'no-constant-binary-expression': 'error',
'ts/default-param-last': 'error',
'require-await': 'error',
'prefer-object-spread': 'error',
'no-useless-concat': 'error',
'no-else-return': 'error',
'no-console': ['error', { allow: ['warn', 'error', 'info', 'time', 'timeEnd'] }],
'require-atomic-updates': 'error',
'style/quotes': ['error', 'single', {
allowTemplateLiterals: true,
avoidEscape: true,
}],
'ts/no-unused-vars': ['warn', {
argsIgnorePattern: '^_',
caughtErrors: 'none',
ignoreRestSiblings: true,
// vars: 'all', // is this helpful?
varsIgnorePattern: '^\\$\\$Props$',
}],

'ts/no-explicit-any': 'warn',
'prefer-named-capture-group': 'warn',

'no-undef': 'off',
'no-unused-vars': 'off',
'no-alert': 'off',
'ts/ban-ts-comment': 'off',
'ts/sort-type-constituents': 'off', // prefer logical rather than alphabetical sorting
},
},
'antfu/svelte/rules': {
files: ['**/*.composition'],
rules: {
'svelte/valid-compile': ['error', { ignoreWarnings: true }], // throws error on a11y issues
'svelte/no-dom-manipulating': 'error',
'svelte/no-store-async': 'error', // causes issues with auto-unsubscribing features
'svelte/require-store-reactive-access': 'error',
'svelte/require-event-dispatcher-types': 'error',
'svelte/button-has-type': 'error',
'svelte/no-extra-reactive-curlies': 'error',
'svelte/mustache-spacing': 'error',
'svelte/html-closing-bracket-spacing': 'error',
'svelte/no-reactive-reassign': ['warn', { props: false }],

'svelte/html-quotes': 'off', // should it enforce double quotes?
'svelte/no-at-html-tags': 'off',
'no-unused-expressions': 'off',
'no-inner-declarations': 'off',
'style/space-infix-ops': 'off',
'no-undef-init': 'off',
'no-self-assign': 'off',
},
},
})

// learn more
// https://github.com/AndreaPontrandolfo/sheriff
// https://github.com/enso-org/enso/blob/b2c1f97437870fa7b7a4d7c2d3630e2d2bd6fc2c/app/ide-desktop/eslint.config.js
// https://github.com/azat-io/eslint-config/blob/044959d8fef2acff50e252b8a238be933cd38eea/base/index.ts
// https://github.com/darkobits/eslint-plugin/blob/f55a64dc9038148f3227cda7ae4543dffcb0b14e/src/config-sets/ts
// https://github.com/azat-io/eslint-config/blob/044959d8fef2acff50e252b8a238be933cd38eea/react/index.ts
17 changes: 0 additions & 17 deletions kitbook.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,5 @@ export default defineConfig({
description: 'Useful Svelte UI pieces for building web apps',
githubURL: 'https://github.com/jacob-8/svelte-pieces',
expandTree: true,
// viewports: [
// {
// name: 'Mobile',
// width: 320,
// height: 568,
// },
// {
// name: 'Desktop',
// width: 1024,
// height: 768,
// },
// {
// name: 'Tablet',
// width: 768,
// height: 1024,
// },
// ],
kitbookRoute: '',
})
Loading

0 comments on commit cb464dc

Please sign in to comment.