Compare commits
8 Commits
@advdomini
...
@advdomini
| Author | SHA1 | Date | |
|---|---|---|---|
|
1c32452e60
|
|||
|
2e18f11fcf
|
|||
|
17378965fd
|
|||
|
14d13915c9
|
|||
|
369595c2de
|
|||
|
49ce40cd7f
|
|||
|
1a8f77622b
|
|||
|
8cf1ddbaf5
|
1
.husky/pre-commit
Executable file
1
.husky/pre-commit
Executable file
@@ -0,0 +1 @@
|
||||
yarn lint-staged
|
||||
@@ -4,5 +4,11 @@ packageExtensions:
|
||||
'lerna@*':
|
||||
dependencies:
|
||||
ci-info: '*'
|
||||
'@advdominion/eslint-config@*':
|
||||
dependencies:
|
||||
eslint: '*'
|
||||
'@advdominion/stylelint-config@*':
|
||||
dependencies:
|
||||
stylelint: '*'
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.12.0.cjs
|
||||
|
||||
8
lint-staged.config.js
Normal file
8
lint-staged.config.js
Normal file
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
'*.js': (filenames) => {
|
||||
return [`eslint --max-warnings 10 --fix ${filenames.join(' ')}`, `prettier --write ${filenames.join(' ')}`];
|
||||
},
|
||||
'*.{json,md,yml}': (filenames) => {
|
||||
return [`prettier --write ${filenames.join(' ')}`];
|
||||
},
|
||||
};
|
||||
@@ -5,10 +5,15 @@
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"postinstall": "husky"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@advdominion/eslint-config": "workspace:*",
|
||||
"eslint": "^10.0.0",
|
||||
"husky": "^9.1.7",
|
||||
"lerna": "^9.0.4",
|
||||
"lint-staged": "^16.2.7",
|
||||
"prettier": "^3.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ njk`
|
||||
|
||||
## Опции
|
||||
|
||||
- `templatesFolder` - строка, обязательный параметр. Путь до папки с файлами шаблонов
|
||||
- `globals` - массив, необязательный параметр. Глобальные переменные для Nunjucks (например, `[{name: "message", value: "Hello, world!"}]`)
|
||||
- `templatesFolder` - строка, обязательный параметр. Путь до папки с файлами шаблонов
|
||||
- `globals` - массив, необязательный параметр. Глобальные переменные для Nunjucks (например, `[{name: "message", value: "Hello, world!"}]`)
|
||||
|
||||
**Важно:** Параметр `cacheDirectory` в опциях babel-loader должен быть отключён.
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import nunjucks from 'nunjucks';
|
||||
|
||||
const babelPluginNunjucks = ({types: t}) => {
|
||||
const babelPluginNunjucks = ({ types: t }) => {
|
||||
return {
|
||||
pre(state) {
|
||||
const options = state.opts.plugins[0].options;
|
||||
this.njkenv = new nunjucks.Environment(new nunjucks.FileSystemLoader(options.templatesFolder));
|
||||
if (options.globals) {
|
||||
for (const {name, value} of options.globals) {
|
||||
for (const { name, value } of options.globals) {
|
||||
this.njkenv.addGlobal(name, value);
|
||||
}
|
||||
}
|
||||
},
|
||||
visitor: {
|
||||
TaggedTemplateExpression(path) {
|
||||
if (path.get('tag').isIdentifier({name: 'njk'})) {
|
||||
if (path.get('tag').isIdentifier({ name: 'njk' })) {
|
||||
const render = this.njkenv.renderString(path.node.quasi.quasis[0].value.raw);
|
||||
path.replaceWith(t.stringLiteral(render));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@advdominion/babel-plugin-nunjucks",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@advdominion/css-var",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@advdominion/eslint-config",
|
||||
"version": "1.1.3",
|
||||
"version": "2.0.0",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -16,9 +16,9 @@
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"eslint-plugin-unicorn": "^63.0.0",
|
||||
"eslint-plugin-vue": "^10.7.0",
|
||||
"eslint-plugin-vue": "^10.8.0",
|
||||
"globals": "^17.3.0",
|
||||
"vue-eslint-parser": "^10.2.0"
|
||||
"vue-eslint-parser": "^10.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^10.0.0"
|
||||
|
||||
@@ -19,11 +19,11 @@ await scrollTo(document.querySelector('#example'), 10);
|
||||
|
||||
## Параметры
|
||||
|
||||
| Параметр | Тип | По умолчанию | Описание |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **$el** | `HTMLElement` | — | DOM-элемент, к которому нужно прокрутить страницу |
|
||||
| **offset** | `number` | `0` | Величина отступа сверху от целевого элемента |
|
||||
| **offsetInPx** | `boolean` | `false` | Тип отступа: `true` — в пикселях, `false` — в процентах от высоты вьюпорта |
|
||||
| Параметр | Тип | По умолчанию | Описание |
|
||||
| :------------- | :------------ | :----------- | :------------------------------------------------------------------------- |
|
||||
| **$el** | `HTMLElement` | — | DOM-элемент, к которому нужно прокрутить страницу |
|
||||
| **offset** | `number` | `0` | Величина отступа сверху от целевого элемента |
|
||||
| **offsetInPx** | `boolean` | `false` | Тип отступа: `true` — в пикселях, `false` — в процентах от высоты вьюпорта |
|
||||
|
||||
## Как это работает
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@advdominion/scroll-to",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
|
||||
22
packages/stylelint-config/README.md
Normal file
22
packages/stylelint-config/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Конфигурация для Stylelint
|
||||
|
||||
Включает в себя:
|
||||
|
||||
- [stylelint-config-standard-scss](https://github.com/stylelint-scss/stylelint-config-standard-scss)
|
||||
- [stylelint-order](https://github.com/hudochenkov/stylelint-order)
|
||||
- Проверку кода тега `<style>` в файлах `.vue`
|
||||
|
||||
## Использование
|
||||
|
||||
### Требования
|
||||
|
||||
- [Stylelint](https://stylelint.io/) ^10.0.0
|
||||
|
||||
### Подключание
|
||||
|
||||
```js
|
||||
export default {
|
||||
extends: ['@advdominion/stylelint-config'],
|
||||
// Дополнительная конфигурация проекта
|
||||
};
|
||||
```
|
||||
55
packages/stylelint-config/index.js
Normal file
55
packages/stylelint-config/index.js
Normal file
@@ -0,0 +1,55 @@
|
||||
/* eslint-disable unicorn/no-null */
|
||||
|
||||
export default {
|
||||
extends: ['stylelint-config-standard-scss'],
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.vue'],
|
||||
customSyntax: 'postcss-html',
|
||||
},
|
||||
],
|
||||
plugins: ['stylelint-order'],
|
||||
rules: {
|
||||
'block-no-empty': null,
|
||||
'no-invalid-double-slash-comments': null,
|
||||
'no-invalid-position-declaration': [true, { ignoreAtRules: ['media'] }],
|
||||
'property-disallowed-list': [
|
||||
'animation',
|
||||
'background',
|
||||
'border',
|
||||
'flex',
|
||||
'font',
|
||||
'grid',
|
||||
'margin',
|
||||
'padding',
|
||||
'transition',
|
||||
],
|
||||
'color-hex-length': 'long',
|
||||
'font-weight-notation': 'named-where-possible',
|
||||
'container-name-pattern': null,
|
||||
'custom-media-pattern': null,
|
||||
'custom-property-pattern': null,
|
||||
'keyframes-name-pattern': null,
|
||||
'layer-name-pattern': null,
|
||||
'selector-class-pattern': null,
|
||||
'selector-id-pattern': null,
|
||||
'declaration-block-no-redundant-longhand-properties': null,
|
||||
'scss/double-slash-comment-empty-line-before': null,
|
||||
'order/order': [
|
||||
{
|
||||
type: 'at-rule',
|
||||
name: 'use',
|
||||
},
|
||||
'dollar-variables',
|
||||
'custom-properties',
|
||||
'declarations',
|
||||
{
|
||||
type: 'at-rule',
|
||||
name: 'include',
|
||||
},
|
||||
'at-rules',
|
||||
'rules',
|
||||
],
|
||||
'order/properties-alphabetical-order': true,
|
||||
},
|
||||
};
|
||||
23
packages/stylelint-config/package.json
Normal file
23
packages/stylelint-config/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@advdominion/stylelint-config",
|
||||
"version": "1.1.0",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitea.optiweb.ru/public/frontend.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"postcss": "^8.5.6",
|
||||
"postcss-html": "^1.8.1",
|
||||
"stylelint-config-standard-scss": "^17.0.0",
|
||||
"stylelint-order": "^7.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"stylelint": "^17.0.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user