Skip to content

Commit

Permalink
Версия 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
efiand committed Oct 26, 2024
1 parent 0890da7 commit 285f358
Show file tree
Hide file tree
Showing 31 changed files with 5,871 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.yml]
indent_size = 2
indent_style = space

[*.min.*]
insert_final_newline = false
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Action
on:
push:
branches:
- main
jobs:
ci:
name: CI
if: ${{ ! contains(github.event.head_commit.message, '[skip') }}
runs-on: ubuntu-latest
steps:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '18'
- name: Checkout
uses: actions/checkout@master
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Env files
.env
.env.*
.htaccess
!.env.example
!.env.test

# Log files
*.log*
logs

# Editor directories and files
*.njsproj
*.ntvs*
*.sln
*.suo
*.sw?
.fleet
.idea
.vscode

# Node dependencies
node_modules
yarn.lock

# Cache
*cache*
.DS_Store
Thumbs.db
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.*
*.md
*.yml
node_modules/
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# shared
A set of common modules (components, configurations, utilities) for any project
# shared [![npm version](https://img.shields.io/npm/v/efiand-shared.svg)](https://www.npmjs.com/package/efiand-shared)

Набор общих модулей (компонентов, конфигураций, утилит) для любого проекта (Vanilla JS, Vue, Nuxt, Svelte).

Разработка внутри внешнего приложения в режиме HMR:

```js
// vite.config.ts

import { watchNodeModules } from 'efiand-shared/config/vite';

export default {
plugins: [watchNodeModules(['efiand-shared'])],
};
```
45 changes: 45 additions & 0 deletions config/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import pluginVue from 'eslint-plugin-vue';
import vueTsEslintConfig from '@vue/eslint-config-typescript';

/** @type {import('eslint').Linter.Config['rules']} */
export const eslintSharedCustomRules = {
'no-console': [
process.env.NODE_ENV === 'production' ? 'warn' : 'off',
{ allow: ['error'] },
],
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/component-name-in-template-casing': [
'error',
'kebab-case',
{
registeredComponentsOnly: false,
ignores: [],
},
],
'vue/html-indent': ['error', 'tab'],
'vue/html-self-closing': 'off',
'vue/max-attributes-per-line': 'off',
'vue/singleline-html-element-content-newline': 'off',
};

/** @type {import('eslint').Linter.Config[]} */
export const eslintConfigs = [
{
files: ['**/*.{js,ts,vue}'],
ignores: ['**/dist/**', '*.min.*'],
},
...pluginVue.configs['flat/strongly-recommended'],
...vueTsEslintConfig(),
{
plugins: {
vue: pluginVue,
},
rules: eslintSharedCustomRules,
},
];

/** @type {(configs?: import('eslint').Linter.Config[]) => import('eslint').Linter.Config[]} */
export const createEslintConfig = (configs = []) => [
...eslintConfigs,
...configs,
];
11 changes: 11 additions & 0 deletions config/postcss.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { AcceptedPlugin } from 'postcss';

declare const postcssConfig: {
plugins?: readonly AcceptedPlugin[];
};

declare const postcssPlugins: {
[key: string]: unknown;
};

export { postcssConfig, postcssPlugins };
20 changes: 20 additions & 0 deletions config/postcss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import autoprefixer from 'autoprefixer';
import sortMediaQueries from 'postcss-sort-media-queries';
import postcssUrl from 'postcss-url';

const postcssUrlOptions = {
filter: '**/icons/*',
url: 'inline',
};

/** @type {{ [key: string]: unknown }}} */
export const postcssPlugins = {
'autoprefixer': {},
'postcss-sort-media-queries': {},
'postcss-url': postcssUrlOptions,
};

/** @type {{ plugins?: readonly import('postcss).AcceptedPlugin[] }}} */
export const postcssConfig = {
plugins: [autoprefixer, sortMediaQueries(), postcssUrl(postcssUrlOptions)],
};
13 changes: 13 additions & 0 deletions config/prettier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import('prettier').Config} */
export const prettierConfig = {
singleQuote: true,
useTabs: true,
trailingComma: 'all',
quoteProps: 'consistent',
arrowParens: 'always',
singleAttributePerLine: false,
htmlWhitespaceSensitivity: 'ignore',
overrides: [{ files: '*.vue', options: { parser: 'vue' } }],
};

export default prettierConfig;
Loading

0 comments on commit 285f358

Please sign in to comment.