Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create style guide basics #2

Merged
merged 12 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import tsParser from '@typescript-eslint/parser';
import eslintPluginSvelte from 'eslint-plugin-svelte';
import svelteParser from 'svelte-eslint-parser';
import svelteConfig from './svelte.config.mjs';
import globals from 'globals';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
...eslintPluginSvelte.configs['flat/recommended'],
...eslintPluginSvelte.configs['flat/prettier'],
{
rules: {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'no-unused-vars': 'off',
indent: ['warn', 2],
'linebreak-style': ['error', 'unix'],
semi: 'warn',
'@typescript-eslint/ban-ts-comment': 'off',
},
},
{
languageOptions: {
globals: {
...globals.browser,
},
},
},
{
languageOptions: {
parser: tsParser,
parserOptions: {
extraFileExtensions: ['.svelte'],
},
},
},
{
files: ['**/*.svelte', '*.svelte'],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: tsParser,
svelteConfig,
},
},
}
);
12 changes: 12 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules/
.env
.env.*
!.env.example
dist
storybook-static

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
storybook-static
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
18 changes: 18 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Exclude Storybook-related files
*.stories.svelte
.storybook/*
*.mdx

# Exclude IDE/editor configuration files
.idea/*

# Exclude ESLint configuration
.eslintrc.js
.eslintignore

# Exclude Prettier configuration
.prettierignore
.prettierrc

# Exclude Stylelint configuration
stylelint.config.js
12 changes: 12 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules
.env
.env.*
!.env.example
dist
storybook-static

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
15 changes: 15 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "auto",
"jsxSingleQuote": false,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"printWidth": 120,
"proseWrap": "always",
"quoteProps": "as-needed",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
10 changes: 10 additions & 0 deletions .storybook/CustomTheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {create} from '@storybook/theming';

export default create({
base: 'dark',
brandTitle: 'Svelte + Storybook + TailwindCSS',
brandUrl: 'https://svelte-storybook-tailwindcss.sveltehub.dev',
brandImage:
'https://sveltehub.dev/templates/storybook-tailwindcss/logo-white.png',
brandTarget: '_blank'
});
18 changes: 18 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** @type { import('@storybook/svelte-vite').StorybookConfig } */
const config = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx|svelte)'],
addons: [
'@storybook/addon-svelte-csf',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions'
],
framework: {
name: '@storybook/svelte-vite',
options: {}
},
docs: {
autodocs: 'tag'
}
};
export default config;
1 change: 1 addition & 0 deletions .storybook/manager-header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6 changes: 6 additions & 0 deletions .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {addons} from '@storybook/addons';
import customTheme from './CustomTheme';

addons.setConfig({
theme: customTheme
});
6 changes: 6 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;600;700&display=swap');
</style>
<script>
window.global = window;
</script>
14 changes: 14 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import '../src/styles/index.css';

export const parameters = {
backgrounds: {
default: 'light'
},
actions: {argTypesRegex: '^on[A-Z].*'},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/
}
}
};
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# style-guide
A style guide to be used for consistent styling across apps.
# Frequency Style Guide

## Svelte + Storybook + TailwindCSS

### Quickstart

```zsh
npm i
npm run storybook
```
Loading