Compare commits
11 Commits
@advdomini
...
@advdomini
| Author | SHA1 | Date | |
|---|---|---|---|
|
fc11cdfa48
|
|||
|
650008ad76
|
|||
|
96ae522a8f
|
|||
|
9dc95dd47a
|
|||
|
bce960599a
|
|||
|
6f24952680
|
|||
|
e1756bd60f
|
|||
|
ea33198344
|
|||
|
ca88f622d1
|
|||
|
9131e220d2
|
|||
|
4012b982a6
|
2
.yarn/sdks/prettier/package.json
vendored
2
.yarn/sdks/prettier/package.json
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "prettier",
|
"name": "prettier",
|
||||||
"version": "3.7.4-sdk",
|
"version": "3.8.0-sdk",
|
||||||
"main": "./index.cjs",
|
"main": "./index.cjs",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"bin": "./bin/prettier.cjs"
|
"bin": "./bin/prettier.cjs"
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
## Публикация новых версий
|
## Публикация новых версий
|
||||||
|
|
||||||
```
|
```bash
|
||||||
yarn lerna publish
|
yarn lerna publish
|
||||||
```
|
```
|
||||||
|
|
||||||
## Обновление зависимостей
|
## Обновление зависимостей
|
||||||
|
|
||||||
```shell
|
```bash
|
||||||
yarn set version stable
|
yarn set version stable
|
||||||
|
|
||||||
yarn install
|
yarn install
|
||||||
|
|||||||
@@ -9,6 +9,6 @@
|
|||||||
"@advdominion/eslint-config": "workspace:*",
|
"@advdominion/eslint-config": "workspace:*",
|
||||||
"eslint": "^9.39.2",
|
"eslint": "^9.39.2",
|
||||||
"lerna": "^9.0.3",
|
"lerna": "^9.0.3",
|
||||||
"prettier": "^3.7.4"
|
"prettier": "^3.8.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,129 +1,25 @@
|
|||||||
/* eslint-disable unicorn/no-useless-spread */
|
import nunjucks from 'nunjucks';
|
||||||
|
|
||||||
import js from '@eslint/js';
|
const babelPluginNunjucks = ({types: t}) => {
|
||||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
return {
|
||||||
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
pre(state) {
|
||||||
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
const options = state.opts.plugins[0].options;
|
||||||
import pluginVue from 'eslint-plugin-vue';
|
this.njkenv = new nunjucks.Environment(new nunjucks.FileSystemLoader(options.templatesFolder));
|
||||||
import globals from 'globals';
|
if (options.globals) {
|
||||||
|
for (const {name, value} of options.globals) {
|
||||||
|
this.njkenv.addGlobal(name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
visitor: {
|
||||||
|
TaggedTemplateExpression(path) {
|
||||||
|
if (path.get('tag').isIdentifier({name: 'njk'})) {
|
||||||
|
const render = this.njkenv.renderString(path.node.quasi.quasis[0].value.raw);
|
||||||
|
path.replaceWith(t.stringLiteral(render));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const config = [
|
export default babelPluginNunjucks;
|
||||||
{
|
|
||||||
languageOptions: {
|
|
||||||
ecmaVersion: 'latest',
|
|
||||||
sourceType: 'module',
|
|
||||||
globals: {
|
|
||||||
...globals.browser,
|
|
||||||
...globals.nodeBuiltin,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
js.configs.recommended,
|
|
||||||
{
|
|
||||||
rules: {
|
|
||||||
...{
|
|
||||||
'array-callback-return': 'error',
|
|
||||||
'no-await-in-loop': 'warn',
|
|
||||||
'no-duplicate-imports': 'warn',
|
|
||||||
'no-promise-executor-return': 'error',
|
|
||||||
'no-self-compare': 'error',
|
|
||||||
'no-template-curly-in-string': 'warn',
|
|
||||||
'no-unassigned-vars': 'warn',
|
|
||||||
'no-unmodified-loop-condition': 'error',
|
|
||||||
'no-unreachable-loop': 'error',
|
|
||||||
'no-use-before-define': 'error',
|
|
||||||
'no-useless-assignment': 'warn',
|
|
||||||
},
|
|
||||||
...{
|
|
||||||
'dot-notation': 'warn',
|
|
||||||
'eqeqeq': 'error',
|
|
||||||
'no-implicit-coercion': 'warn',
|
|
||||||
'no-negated-condition': 'warn',
|
|
||||||
'no-useless-concat': 'warn',
|
|
||||||
'object-shorthand': 'warn',
|
|
||||||
'func-style': 'error',
|
|
||||||
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
||||||
'no-param-reassign': 'error',
|
|
||||||
'no-var': 'error',
|
|
||||||
'one-var': ['warn', 'never'],
|
|
||||||
'prefer-const': 'warn',
|
|
||||||
'prefer-template': 'warn',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
plugins: {
|
|
||||||
'simple-import-sort': simpleImportSort,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
'simple-import-sort/imports': 'warn',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
plugins: {
|
|
||||||
unicorn: eslintPluginUnicorn,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
...Object.fromEntries(
|
|
||||||
Object.entries(eslintPluginUnicorn.configs.recommended.rules).map(([rule, level]) => [
|
|
||||||
rule,
|
|
||||||
level === 'off' ? 'off' : 'warn',
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
'unicorn/better-regex': 'warn',
|
|
||||||
'unicorn/filename-case': ['warn', { cases: { kebabCase: true, pascalCase: true } }],
|
|
||||||
'unicorn/prefer-global-this': 'off',
|
|
||||||
'unicorn/prefer-import-meta-properties': 'warn',
|
|
||||||
'unicorn/prefer-top-level-await': 'off',
|
|
||||||
'unicorn/prevent-abbreviations': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...pluginVue.configs['flat/recommended'],
|
|
||||||
{
|
|
||||||
rules: {
|
|
||||||
...{
|
|
||||||
'vue/no-v-html': 'off',
|
|
||||||
'vue/one-component-per-file': 'off',
|
|
||||||
},
|
|
||||||
...{
|
|
||||||
'vue/component-name-in-template-casing': 'warn',
|
|
||||||
'vue/component-options-name-casing': 'warn',
|
|
||||||
'vue/custom-event-name-casing': 'warn',
|
|
||||||
'vue/match-component-file-name': ['warn', { extensions: ['vue'], shouldMatchCase: true }],
|
|
||||||
'vue/match-component-import-name': 'warn',
|
|
||||||
'vue/no-boolean-default': 'warn',
|
|
||||||
'vue/no-potential-component-option-typo': 'warn',
|
|
||||||
'vue/no-useless-mustaches': 'warn',
|
|
||||||
'vue/no-useless-v-bind': 'warn',
|
|
||||||
'vue/require-direct-export': 'warn',
|
|
||||||
'vue/require-name-property': 'warn',
|
|
||||||
'vue/v-for-delimiter-style': 'warn',
|
|
||||||
'vue/v-on-handler-style': ['warn', 'inline'],
|
|
||||||
},
|
|
||||||
...{
|
|
||||||
'vue/dot-notation': 'warn',
|
|
||||||
'vue/eqeqeq': 'error',
|
|
||||||
'vue/no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
||||||
'vue/no-constant-condition': 'error',
|
|
||||||
'vue/no-empty-pattern': 'error',
|
|
||||||
'vue/no-implicit-coercion': 'warn',
|
|
||||||
'vue/no-irregular-whitespace': 'error',
|
|
||||||
'vue/no-loss-of-precision': 'error',
|
|
||||||
'vue/no-negated-condition': 'warn',
|
|
||||||
'vue/no-sparse-arrays': 'error',
|
|
||||||
'vue/no-useless-concat': 'warn',
|
|
||||||
'vue/object-shorthand': 'warn',
|
|
||||||
'vue/prefer-template': 'warn',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ['**/*.vue'],
|
|
||||||
rules: {
|
|
||||||
'no-useless-assignment': 'off', // ESLint не умеет работать с этим правилом внутри <template>
|
|
||||||
},
|
|
||||||
},
|
|
||||||
eslintConfigPrettier,
|
|
||||||
];
|
|
||||||
|
|
||||||
export default config;
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@advdominion/babel-plugin-nunjucks",
|
"name": "@advdominion/babel-plugin-nunjucks",
|
||||||
"version": "3.0.1",
|
"version": "3.0.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nunjucks": "^3.0.0"
|
"nunjucks": "^3.2.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": "^7.0.0"
|
"@babel/core": "^7.0.0"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@advdominion/eslint-config",
|
"name": "@advdominion/eslint-config",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||||
"eslint-plugin-unicorn": "^62.0.0",
|
"eslint-plugin-unicorn": "^62.0.0",
|
||||||
"eslint-plugin-vue": "^10.6.2",
|
"eslint-plugin-vue": "^10.7.0",
|
||||||
"globals": "^16.5.0",
|
"globals": "^17.0.0",
|
||||||
"vue-eslint-parser": "^10.2.0"
|
"vue-eslint-parser": "^10.2.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
# is
|
|
||||||
|
|
||||||
Check variable type
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { is } from '@advdominion/is';
|
|
||||||
|
|
||||||
console.log(is('Hello, world!', 'String'));
|
|
||||||
```
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
export const is = (obj, type) => {
|
|
||||||
return Object.prototype.toString.call(obj).slice(8, -1) === type && obj !== undefined && obj !== null;
|
|
||||||
};
|
|
||||||
53
packages/lightningcss-loader/README.md
Normal file
53
packages/lightningcss-loader/README.md
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# lightningcss-loader
|
||||||
|
|
||||||
|
[Lightning CSS](https://lightningcss.dev) loader for [Webpack](https://webpack.js.org)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { transform } from 'lightningcss';
|
||||||
|
|
||||||
|
return {
|
||||||
|
...,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.css$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: '@advdominion/lightningcss-loader',
|
||||||
|
options: {
|
||||||
|
implementation: transform,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### Passing options to Lightning CSS
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { transform } from 'lightningcss';
|
||||||
|
|
||||||
|
return {
|
||||||
|
...,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.css$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: '@advdominion/lightningcss-loader',
|
||||||
|
options: {
|
||||||
|
implementation: transform,
|
||||||
|
drafts: {
|
||||||
|
customMedia: true,
|
||||||
|
},
|
||||||
|
minify: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
```
|
||||||
22
packages/lightningcss-loader/index.js
Normal file
22
packages/lightningcss-loader/index.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
const lightningcssLoader = function (source, sourceMap) {
|
||||||
|
const { implementation, ...options } = this.getOptions();
|
||||||
|
const callback = this.async();
|
||||||
|
|
||||||
|
if (typeof implementation !== 'function') {
|
||||||
|
throw new TypeError(
|
||||||
|
`[lightningcss-loader]: The "implementation" option is required and must provide "transform" function of the LightningCSS`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { code, map } = implementation({
|
||||||
|
filename: this.resourcePath,
|
||||||
|
code: Buffer.from(source),
|
||||||
|
sourceMap: this.sourceMap,
|
||||||
|
inputSourceMap: this.sourceMap && sourceMap ? JSON.stringify(sourceMap) : undefined,
|
||||||
|
...options,
|
||||||
|
});
|
||||||
|
|
||||||
|
callback(undefined, code.toString(), map && JSON.parse(map.toString()));
|
||||||
|
};
|
||||||
|
|
||||||
|
export default lightningcssLoader;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@advdominion/is",
|
"name": "@advdominion/lightningcss-loader",
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
39
yarn.lock
39
yarn.lock
@@ -9,7 +9,7 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@advdominion/babel-plugin-nunjucks@workspace:packages/babel-plugin-nunjucks"
|
resolution: "@advdominion/babel-plugin-nunjucks@workspace:packages/babel-plugin-nunjucks"
|
||||||
dependencies:
|
dependencies:
|
||||||
nunjucks: "npm:^3.0.0"
|
nunjucks: "npm:^3.2.4"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
"@babel/core": ^7.0.0
|
"@babel/core": ^7.0.0
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
@@ -23,8 +23,8 @@ __metadata:
|
|||||||
eslint-config-prettier: "npm:^10.1.8"
|
eslint-config-prettier: "npm:^10.1.8"
|
||||||
eslint-plugin-simple-import-sort: "npm:^12.1.1"
|
eslint-plugin-simple-import-sort: "npm:^12.1.1"
|
||||||
eslint-plugin-unicorn: "npm:^62.0.0"
|
eslint-plugin-unicorn: "npm:^62.0.0"
|
||||||
eslint-plugin-vue: "npm:^10.6.2"
|
eslint-plugin-vue: "npm:^10.7.0"
|
||||||
globals: "npm:^16.5.0"
|
globals: "npm:^17.0.0"
|
||||||
vue-eslint-parser: "npm:^10.2.0"
|
vue-eslint-parser: "npm:^10.2.0"
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^9.39.0
|
eslint: ^9.39.0
|
||||||
@@ -37,9 +37,9 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"@advdominion/is@workspace:packages/is":
|
"@advdominion/lightningcss-loader@workspace:packages/lightningcss-loader":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@advdominion/is@workspace:packages/is"
|
resolution: "@advdominion/lightningcss-loader@workspace:packages/lightningcss-loader"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -2475,9 +2475,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"eslint-plugin-vue@npm:^10.6.2":
|
"eslint-plugin-vue@npm:^10.7.0":
|
||||||
version: 10.6.2
|
version: 10.7.0
|
||||||
resolution: "eslint-plugin-vue@npm:10.6.2"
|
resolution: "eslint-plugin-vue@npm:10.7.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@eslint-community/eslint-utils": "npm:^4.4.0"
|
"@eslint-community/eslint-utils": "npm:^4.4.0"
|
||||||
natural-compare: "npm:^1.4.0"
|
natural-compare: "npm:^1.4.0"
|
||||||
@@ -2495,7 +2495,7 @@ __metadata:
|
|||||||
optional: true
|
optional: true
|
||||||
"@typescript-eslint/parser":
|
"@typescript-eslint/parser":
|
||||||
optional: true
|
optional: true
|
||||||
checksum: 10c0/3d3705e6906f6a55529ba99d1ab4e952f2178e109bdab21cc486ef8fee6cd4d4434a4bcb9e77b4d4a8d511dbb2f99deeaeaf22d2847ab3c2ab3d130358a4f8a0
|
checksum: 10c0/52ae339373a4fc032e1a45871050b91b7eab75903edaf1ea044032e1039acef62304ef8fc2965075c821a26adf44ee323d37e274d252b7f1b122b3520735709c
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -3084,13 +3084,20 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"globals@npm:^16.4.0, globals@npm:^16.5.0":
|
"globals@npm:^16.4.0":
|
||||||
version: 16.5.0
|
version: 16.5.0
|
||||||
resolution: "globals@npm:16.5.0"
|
resolution: "globals@npm:16.5.0"
|
||||||
checksum: 10c0/615241dae7851c8012f5aa0223005b1ed6607713d6813de0741768bd4ddc39353117648f1a7086b4b0fa45eae733f1c0a0fe369aa4e543bb63f8de8990178ea9
|
checksum: 10c0/615241dae7851c8012f5aa0223005b1ed6607713d6813de0741768bd4ddc39353117648f1a7086b4b0fa45eae733f1c0a0fe369aa4e543bb63f8de8990178ea9
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"globals@npm:^17.0.0":
|
||||||
|
version: 17.0.0
|
||||||
|
resolution: "globals@npm:17.0.0"
|
||||||
|
checksum: 10c0/e3c169fdcb0fc6755707b697afb367bea483eb29992cfc0de1637382eb893146e17f8f96db6d7453e3696b478a7863ae2000e6c71cd2f4061410285106d3847a
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"gopd@npm:^1.2.0":
|
"gopd@npm:^1.2.0":
|
||||||
version: 1.2.0
|
version: 1.2.0
|
||||||
resolution: "gopd@npm:1.2.0"
|
resolution: "gopd@npm:1.2.0"
|
||||||
@@ -4690,7 +4697,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"nunjucks@npm:^3.0.0":
|
"nunjucks@npm:^3.2.4":
|
||||||
version: 3.2.4
|
version: 3.2.4
|
||||||
resolution: "nunjucks@npm:3.2.4"
|
resolution: "nunjucks@npm:3.2.4"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -5245,12 +5252,12 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"prettier@npm:^3.7.4":
|
"prettier@npm:^3.8.0":
|
||||||
version: 3.7.4
|
version: 3.8.0
|
||||||
resolution: "prettier@npm:3.7.4"
|
resolution: "prettier@npm:3.8.0"
|
||||||
bin:
|
bin:
|
||||||
prettier: bin/prettier.cjs
|
prettier: bin/prettier.cjs
|
||||||
checksum: 10c0/9675d2cd08eacb1faf1d1a2dbfe24bfab6a912b059fc9defdb380a408893d88213e794a40a2700bd29b140eb3172e0b07c852853f6e22f16f3374659a1a13389
|
checksum: 10c0/8926e9c9941a293b76c2d799089d038e9f6d84fb37702fc370bedd03b3c70d7fcf507e2e3c4f151f222d81820a3b74cac5e692c955cfafe34dd0d02616ce8327
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -5582,7 +5589,7 @@ __metadata:
|
|||||||
"@advdominion/eslint-config": "workspace:*"
|
"@advdominion/eslint-config": "workspace:*"
|
||||||
eslint: "npm:^9.39.2"
|
eslint: "npm:^9.39.2"
|
||||||
lerna: "npm:^9.0.3"
|
lerna: "npm:^9.0.3"
|
||||||
prettier: "npm:^3.7.4"
|
prettier: "npm:^3.8.0"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user