Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
3y3 committed Aug 10, 2024
0 parents commit df0724a
Show file tree
Hide file tree
Showing 21 changed files with 6,410 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
push:
branches: [master]

name: release

permissions:
contents: write
pull-requests: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: gravity-ui/release-action@v1
with:
github-token: ${{ secrets.YC_UI_BOT_GITHUB_TOKEN }}
npm-token: ${{ secrets.ROBOT_DATAUI_NPM_TOKEN }}
node-version: 18
default-branch: ${{ github.ref_name != 'master' && github.ref_name || null }}
npm-dist-tag: ${{ github.ref_name != 'master' && 'untagged' || 'latest' }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Notice to external contributors


## General info

Hello! In order for us (YANDEX LLC) to accept patches and other contributions from you, you will have to adopt our Yandex Contributor License Agreement (the “**CLA**”). The current version of the CLA can be found here:
1) https://yandex.ru/legal/cla/?lang=en (in English) and
2) https://yandex.ru/legal/cla/?lang=ru (in Russian).

By adopting the CLA, you state the following:

* You obviously wish and are willingly licensing your contributions to us for our open source projects under the terms of the CLA,
* You have read the terms and conditions of the CLA and agree with them in full,
* You are legally able to provide and license your contributions as stated,
* We may use your contributions for our open source projects and for any other our project too,
* We rely on your assurances concerning the rights of third parties in relation to your contributions.

If you agree with these principles, please read and adopt our CLA. By providing us your contributions, you hereby declare that you have already read and adopt our CLA, and we may freely merge your contributions with our corresponding open source project and use it in further in accordance with terms and conditions of the CLA.

## Provide contributions

If you have already adopted terms and conditions of the CLA, you are able to provide your contributions. When you submit your pull request, please add the following information into it:

```
I hereby agree to the terms of the CLA available at: [link].
```

Replace the bracketed text as follows:
* [link] is the link to the current version of the CLA: https://yandex.ru/legal/cla/?lang=en (in English) or https://yandex.ru/legal/cla/?lang=ru (in Russian).

It is enough to provide us such notification once.

## Other questions

If you have any questions, please mail us at [email protected].
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Yandex LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[![NPM version](https://img.shields.io/npm/v/@diplodoc/lint.svg?style=flat)](https://www.npmjs.org/package/@diplodoc/lint)

# @diplodoc/lint

Diplodoc platform internal utility set for linting


## Install

```
npm install --save-dev @diplodoc/lint
```

## Usage

Add initial configuration

```sh
npx @diplodoc/lint install
git add --all && git commit -m 'chore: init lint'
```

Run lint

```sh
npm run lint
```

Run lint in fix mode

```sh
npm run lint:fix
```
54 changes: 54 additions & 0 deletions bin/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

set -e

BINDIR=$(dirname $0)
SRCDIR=$(dirname $(dirname $(node -pe "require('fs').realpathSync('$0')")))

while (( $# )); do
case "$1" in
--fix ) :
FIX=1
;;
install|init ) :
INIT=1
;;
esac
shift
done

if [[ -n $INIT ]]; then
echo "[@diplodoc/lint] Add initial lint configs"

cp -r "$SRCDIR/scaffolding/" .

echo "[@diplodoc/lint] Extend package.json configuration"

node "$SRCDIR/scripts/modify-package.js"

echo "[@diplodoc/lint] Extend .ignore configuration"

node "$SRCDIR/scripts/modify-ignore.js"

$BINDIR/husky install

exit 0
fi

if [[ -n $FIX ]]; then
echo "Run linters in fix mode"

$BINDIR/eslint '**/*.{js,jsx,ts,tsx}' --fix
$BINDIR/prettier --write 'src/**/*.{js,jsx,ts,tsx}'
$BINDIR/stylelint src/**/*.scss --fix

exit 0
fi

echo "Run linters"

$BINDIR/eslint '**/*.{js,jsx,ts,tsx}'
$BINDIR/prettier --check 'src/**/*.{js,jsx,ts,tsx}'
$BINDIR/stylelint src/**/*.scss


7 changes: 7 additions & 0 deletions eslint-client-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
root: true,
extends: [
'@gravity-ui/eslint-config/client',
'./eslint-common-config.js',
],
};
36 changes: 36 additions & 0 deletions eslint-common-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
root: true,
extends: [
'@gravity-ui/eslint-config',
process.env.npm_command && '@gravity-ui/eslint-config/prettier',
].filter(Boolean),
parserOptions: {
project: ["./tsconfig.json"]
},
rules: {
'callback-return': 'off',
'consistent-return': 'off',
'no-implicit-globals': 'off',
'no-param-reassign': 'off',
'@typescript-eslint/no-shadow': 'off',
'import/no-extraneous-dependencies': 'error',
'import/order': [
'error',
{
alphabetize: {
order: 'ignore',
orderImportKind: 'asc'
},
'newlines-between': 'always',
groups: ['type', ['builtin', 'external'], 'internal', 'parent', 'sibling', 'index'],
warnOnUnassignedImports: true,
pathGroups: [
{
pattern: '*.s?css$',
group: 'index',
},
],
},
],
},
};
9 changes: 9 additions & 0 deletions eslint-node-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: [
'./eslint-common-config.js',
],
env: {
node: true,
},
};
3 changes: 3 additions & 0 deletions eslint-prettier-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'extends': ['plugin:prettier/recommended'],
};
Loading

0 comments on commit df0724a

Please sign in to comment.