diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..af80037 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,83 @@ +{ + "extends": [ + "eslint:recommended", + "plugin:node/recommended", + "prettier" + ], + "plugins": [ + "node", + "prettier" + ], + "rules": { + "prettier/prettier": "error", + "block-scoped-var": "error", + "eqeqeq": "error", + "no-var": "error", + "prefer-const": "error", + "eol-last": "error", + "prefer-arrow-callback": "error", + "no-trailing-spaces": "error", + "quotes": [ + "warn", + "single", + { + "avoidEscape": true + } + ], + "no-restricted-properties": [ + "error", + { + "object": "describe", + "property": "only" + }, + { + "object": "it", + "property": "only" + } + ] + }, + "overrides": [ + { + "files": [ + "**/*.ts", + "**/*.tsx" + ], + "parser": "@typescript-eslint/parser", + "extends": [ + "plugin:@typescript-eslint/recommended" + ], + "rules": { + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-warning-comments": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/camelcase": "off", + "node/no-missing-import": "off", + "node/no-empty-function": "off", + "node/no-unpublished-import": "off", + "node/no-unsupported-features/es-syntax": "off", + "node/no-missing-require": "off", + "node/shebang": "off", + "no-dupe-class-members": "off", + "require-atomic-updates": "off" + }, + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + } + } + ], + "ignorePatterns": [ + "build/", + "dist/", + "**/i18n/custom-types.ts", + "**/i18n/formatters.ts", + "**/i18n/i18b-*.ts" + ] +} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..2888a11 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,25 @@ +name: CI + +on: + push: + branches: + - development + pull_request: + types: [ assigned, opened, synchronize, reopened, labeled ] + +env: + DAZLAB_PAT: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: read + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + - run: yarn install + - run: yarn lint diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d217149 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,34 @@ +name: Release + +on: + push: + branches-ignore: + - '*' + tags: + - '*.*.*' # push to versioned tag will trigger this build + +env: + DAZLAB_PAT: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + - run: yarn install + - run: yarn lint + - run: npm publish --access=restricted + - run: | + gh release create "$GITHUB_REF_NAME" \ + --repo="$GITHUB_REPOSITORY" \ + --title="Release ${GITHUB_REF_NAME#v}" \ + --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9dea4fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.DS_Store +.idea +.yarn/cache +dist +node_modules +yarn.lock diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..81769d0 --- /dev/null +++ b/.npmrc @@ -0,0 +1,3 @@ +//npm.pkg.github.com/:_authToken=${DAZLAB_PAT} +@dazlab-team:registry=https://npm.pkg.github.com/ +always-auth=true diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..457c19c --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1,4 @@ +npmScopes: + dazlab-team: + npmRegistryServer: "https://npm.pkg.github.com" + npmAuthToken: ${DAZLAB_PAT:-fallback} diff --git a/README.md b/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/index.js b/index.js new file mode 100644 index 0000000..f9af97d --- /dev/null +++ b/index.js @@ -0,0 +1 @@ +module.exports = require('./.eslintrc.json') diff --git a/package.json b/package.json new file mode 100644 index 0000000..e20a51d --- /dev/null +++ b/package.json @@ -0,0 +1,48 @@ +{ + "name": "@dazlab-team/eslint-config", + "version": "0.0.1", + "license": "UNLICENSED", + "description": "Shared ESLint Configuration Package", + "publishConfig": { + "access": "restricted", + "registry": "https://npm.pkg.github.com" + }, + "repository": { + "type": "git", + "url": "https://github.com/dazlab-team/eslint-config.git" + }, + "files": [ + "index.js", + ".eslintrc.json" + ], + "engines": { + "node": ">=16" + }, + "main": "index.js", + "keywords": [ + "eslint", + "eslintconfig", + "prettier", + "prettierrc" + ], + "scripts": { + "lint": "eslint .", + "fix": "eslint --fix .", + "prettier": "npx prettier --write ." + }, + "prettier": "@dazlab-team/prettier-config", + "dependencies": { + "@typescript-eslint/eslint-plugin": "^6.9.0", + "@typescript-eslint/parser": "^6.9.0", + "eslint": "^8.52.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^5.0.1", + "prettier": "^3.0.3" + }, + "devDependencies": { + "@types/node": "^16.11.7", + "@dazlab-team/prettier-config": "^0.0.1", + "typescript": ">=4 <5" + } +}