Skip to content

Commit

Permalink
feat: update all repo files from alwatr (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
alimd authored Sep 14, 2024
2 parents 5156c6d + e8f8281 commit ed1adcb
Show file tree
Hide file tree
Showing 58 changed files with 5,154 additions and 3,733 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
max_line_length = 140

[*.{js,ts}]
block_comment_start = /**
Expand Down
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.js
*.mjs
*.cjs
*.d.ts
/demo/es-bench/
/uniquely/flight-finder-pwa
Expand Down
85 changes: 1 addition & 84 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,87 +1,4 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/stylistic",
// "plugin:@typescript-eslint/strict-type-checked",
// "plugin:@typescript-eslint/stylistic-type-checked",
"plugin:import/recommended",
"plugin:import/typescript"
],
"env": {
"shared-node-browser": true,
"es2023": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": true,
"ecmaVersion": 2023,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "import"],
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"ecmaVersion": 2023,
"project": ["**/tsconfig.json"],
"projectFolderIgnoreList": ["**/node_modules/**"]
},
"node": true
}
},
"rules": {
"max-len": ["error", {"code": 120}],
"no-eval": ["error", {"allowIndirect": true}],
"no-floating-decimal": "error",
"space-infix-ops": "error",
"new-cap": ["error", {"capIsNewExceptionPattern": "Mixin$"}],
"brace-style": ["error", "stroustrup", {"allowSingleLine": true}],
"indent": "off",
"@typescript-eslint/indent": [
"error",
2,
{
"SwitchCase": 1,
"VariableDeclarator": 1,
"outerIIFEBody": 1,
"MemberExpression": 1,
"FunctionDeclaration": {"parameters": 1, "body": 1},
"FunctionExpression": {"parameters": 1, "body": 1},
"CallExpression": {"arguments": 1},
"ArrayExpression": 1,
"ObjectExpression": 1,
"ImportDeclaration": 1,
"flatTernaryExpressions": false,
"ignoreComments": false,
"ignoredNodes": [
"TemplateLiteral *",
"TSTypeParameterInstantiation",
"FunctionExpression > .params[decorators.length > 0]",
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
]
}
],
"operator-linebreak": ["error", "after", {"overrides": {"?": "before", ":": "before"}}],
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", ["parent", "sibling", "index"], "object", "unknown", "type"],
"newlines-between": "always",
"warnOnUnassignedImports": true,
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"@typescript-eslint/prefer-string-starts-ends-with": "off",
"@typescript-eslint/no-dynamic-delete": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"no-throw-literal": "off",
"require-jsdoc": "off",
"valid-jsdoc": "off"
}
"extends": "@alwatr/eslint-config"
}
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

8 changes: 6 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ updates:
- package-ecosystem: github-actions
directory: /
open-pull-requests-limit: 20
commit-message:
prefix: 'deps'
reviewers:
- AliMD
schedule:
interval: weekly
time: '00:30'
day: thursday
day: 'thursday'
labels:
- ci
- priority-low
Expand All @@ -24,12 +26,14 @@ updates:
directory: /
versioning-strategy: increase
open-pull-requests-limit: 20
commit-message:
prefix: 'deps'
reviewers:
- AliMD
schedule:
interval: weekly
time: '00:30'
day: thursday
day: 'thursday'
labels:
- dependencies
- ci
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/build-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:

steps:
- name: ⤵️ Checkout repository
uses: actions/[email protected].1
uses: actions/[email protected].7

- name: 🏗 Setup nodejs
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
node-version: ${{ env.NODE_VERSION }}

Expand All @@ -40,7 +40,7 @@ jobs:
run: echo "cache_folder=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: 🏗 Cache Layer
uses: actions/cache@v3.3.2
uses: actions/cache@v4.0.2
# id: yarn_cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn_config.outputs.cache_folder }}
Expand All @@ -56,3 +56,6 @@ jobs:

- name: 🚀 Run ESLint
run: yarn lint

- name: 🚀 Run Jest
run: yarn test
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ jobs:

steps:
- name: ⤵️ Checkout repository
uses: actions/[email protected].1
uses: actions/[email protected].7

- name: 🏗 Initialize CodeQL
uses: github/codeql-action/init@v3.22.11
uses: github/codeql-action/init@v3.26.6
with:
languages: ${{ matrix.language }}
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- name: 🏗 Auto build
uses: github/codeql-action/autobuild@v3.22.11
uses: github/codeql-action/autobuild@v3.26.6

- name: 🚀 Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.22.11
uses: github/codeql-action/analyze@v3.26.6
4 changes: 2 additions & 2 deletions .github/workflows/dependency-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: ⤵️ Checkout repository
uses: actions/[email protected].1
uses: actions/[email protected].7

- name: 🚀 Dependency Review
uses: actions/dependency-review-action@v3.1.4
uses: actions/dependency-review-action@v4.3.4
6 changes: 3 additions & 3 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:

steps:
- name: ⤵️ Checkout repository
uses: actions/[email protected].1
uses: actions/[email protected].7

- name: 🏗 Setup nodejs
uses: actions/[email protected].1
uses: actions/[email protected].3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
Expand All @@ -40,7 +40,7 @@ jobs:
run: echo "cache_folder=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: 🏗 Cache Layer
uses: actions/cache@v3.3.2
uses: actions/cache@v4.0.2
# id: yarn_cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn_config.outputs.cache_folder }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].1
uses: actions/[email protected].7

- name: 🚀 Run Label Syncer
uses: micnncim/[email protected]
Expand Down
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ package-lock.json

# Build
dist
build
.tsbuildinfo
*.tsbuildinfo
*.map
*.d.ts
*.js
!*.config.js
!**/res/*.js

# Output of 'npm pack'
*.tgz

# dotenv environment variables file
.env

.tmp
4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

56 changes: 29 additions & 27 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
{
"npm.packageManager": "yarn",
"editor.wordWrapColumn": 120,
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
"cSpell.language": "en,fa,fa-IR",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"js/ts.implicitProjectConfig.checkJs": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.useEditorConfig": true,
"files.exclude": {
"**/*.map": true,
"**/*.d.ts": true,
"**/*.tsbuildinfo": true
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
"editor.wordWrapColumn": 120,
"eslint.nodePath": ".yarn/sdks",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts, ${capture}.d.ts.map",
"*.ts": "${capture}.js, ${capture}.js.map, ${capture}.d.ts, ${capture}.d.ts.map",
"tsconfig.json": "tsconfig.*.json, *.tsbuildinfo"
},
"files.associations": {
"*.mt": "routeros",
"*.conf.template": "nginx",
"ssh_config": "ssh_config",
"*.njk": "html",
"ssh-config": "ssh_config"
"files.exclude": {
// "**/*.map": true,
// "**/*.d.ts": true,
// "**/*.tsbuildinfo": true
},
"markdownlint.ignore": [
"**/CHANGELOG.md"
],
"cSpell.language": "en,fa,fa-IR",
"cSpell.words": [
"alwatr"
],
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"git.autoStash": true,
"git.branchProtection": [
"main",
Expand All @@ -37,11 +30,20 @@
"main",
"next"
],
"markdownlint.ignore": [
"**/CHANGELOG.md"
],
"npm.packageManager": "yarn",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"prettier.useEditorConfig": true,
"search.exclude": {
"**/.pnp.*": true,
"**/.yarn": true,
"**/.pnp.*": true
"**/*.lock": true
},
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"typescript.enablePromptUseWorkspaceTsdk": true
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"cSpell.words": [
"Alwatr"
]
}
32 changes: 32 additions & 0 deletions .yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);

const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}

const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = wrapWithUserWrapper(absRequire(`eslint/bin/eslint.js`));
32 changes: 32 additions & 0 deletions .yarn/sdks/eslint/lib/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);

const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}

const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;

// Defer to the real eslint your application uses
module.exports = wrapWithUserWrapper(absRequire(`eslint`));
Loading

0 comments on commit ed1adcb

Please sign in to comment.