Skip to content

Commit

Permalink
refactor: use custom eslint config + prettier instead of airbnb config (
Browse files Browse the repository at this point in the history
electron#2520)

* chore: add test scripts
  • Loading branch information
malept authored Sep 12, 2021
1 parent bc0ed95 commit 0deb74b
Show file tree
Hide file tree
Showing 218 changed files with 4,748 additions and 4,274 deletions.
9 changes: 2 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"sourceMaps": "inline",
"ignore": [
"./tmpl"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"source-map-support"
],
"ignore": ["./tmpl"],
"plugins": ["@babel/plugin-proposal-class-properties", "source-map-support"],
"presets": [
[
"@babel/preset-env",
Expand Down
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
dist
docs/
node_modules
*.d.ts
packages/*/*/doc
packages/*/*/index.ts
packages/**/bad.js
tmpl
136 changes: 69 additions & 67 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,90 +1,92 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
},
"plugins": [
"mocha",
"@typescript-eslint"
],
"plugins": ["mocha"],
"env": {
"mocha": true,
"node": true
"mocha": true
},
"extends": [
"airbnb-base",
"plugin:import/typescript"
],
"extends": ["@malept/eslint-config/src/common"],
"globals": {
"NodeJS": "readonly"
},
"rules": {
"class-methods-use-this": "off",
"import/extensions": [
"no-unused-vars": [
"error",
"always",
{
"js": "never",
"ts": "never"
"args": "after-used",
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true,
"vars": "all"
}
],
"import/no-cycle": "off",
"import/no-extraneous-dependencies": ["error", { "devDependencies": ["packages/**/test/**/*_spec*.ts"] }],
"mocha/no-exclusive-tests": "error",
"no-await-in-loop": "off",
"no-param-reassign": "off",
"no-restricted-syntax": [
"error",
{
"selector": "ForInStatement",
"message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
},
{
"selector": "LabeledStatement",
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
},
{
"selector": "WithStatement",
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
}
],
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"no-unused-vars": "off",
"@typescript-eslint/no-this-alias": ["error", {
"allowDestructuring": true
}],
"@typescript-eslint/no-unused-vars": ["error", {
"args": "after-used",
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true,
"vars": "all"
}],
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"]
"mocha/no-exclusive-tests": "error"
},
"overrides": [
{
"files": ["**/*.ts"],
"extends": ["@malept/eslint-config/src/typescript"],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "after-used",
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true,
"vars": "all"
}
]
}
},
{
"files": ["packages/*/*/test/**/*_spec*.ts"],
"rules": {
"global-require": "off",
"import/no-dynamic-require": "off"
}
}
],
"settings": {
"import/extensions": [
".js",
".ts"
],
"import/parsers": {
"@typescript-eslint/parser": [".ts"]
},
"import/resolver": {
"node": {
"extensions": [".js", ".json", ".ts"]
{
"files": ["packages/api/cli/src/**/*.ts", "tools/*.{js,ts}"],
"rules": {
"no-process-exit": "off"
}
},
{
"files": ["packages/api/core/test/**/*.ts", "packages/maker/*/src/Maker*.ts"],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
},
{
"files": ["packages/*/*/test/fixture/**/*.js", "packages/*/*/test/fixtures/**/*.js"],
"rules": {
"node/no-extraneous-require": "off",
"node/no-missing-require": "off",
"node/no-unpublished-require": "off"
}
},
{
"files": ["packages/plugin/webpack/test/fixtures/**/*.js"],
"rules": {
"no-process-exit": "off",
"no-undef": "off",
"import/no-unresolved": "off",
"node/no-missing-import": "off",
"node/no-unpublished-import": "off",
"node/no-unsupported-features/es-syntax": "off"
}
},
{
"files": ["packages/utils/web-multi-logger/static/*.js"],
"env": {
"browser": true,
"node": false
}
},
{
"files": ["tools/*.{js,ts}"],
"rules": {
"node/no-unpublished-import": "off",
"node/no-unpublished-require": "off",
"node/shebang": "off"
}
}
}
]
}
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug report
description: Create a report to help us improve Electron Forge
labels: "Bug"
labels: 'Bug'

body:
- type: checkboxes
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ blank_issues_enabled: false
contact_links:
- name: Question
url: https://discord.gg/electron
about: "Please ask questions about using Electron Forge in the official Electron Discord server, at the #electron-forge channel."
about: 'Please ask questions about using Electron Forge in the official Electron Discord server, at the #electron-forge channel.'
- name: Website Issues
url: https://github.com/electron-forge/electron-forge-docs/issues/new
about: Website issues / pull requests should be filed in the website repository.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Feature request
description: Suggest an idea for Electron Forge
labels: "Enhancement"
labels: 'Enhancement'

body:
- type: checkboxes
Expand Down
38 changes: 19 additions & 19 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
# Check the npm registry for updates every weekday
schedule:
interval: "daily"
interval: 'daily'
ignore: # Everything not annotated here is documented in tools/update-dependencies.js
# @aws-sdk/* upgrades too often, do this manually
- dependency-name: "@aws-sdk/client-s3"
- dependency-name: "@aws-sdk/lib-storage"
- dependency-name: "@aws-sdk/types"
- dependency-name: "@types/node-fetch"
- dependency-name: '@aws-sdk/client-s3'
- dependency-name: '@aws-sdk/lib-storage'
- dependency-name: '@aws-sdk/types'
- dependency-name: '@types/node-fetch'
- dependency-name: commander
- dependency-name: electron-notarize
- dependency-name: find-up
- dependency-name: log-symbols
- dependency-name: node-fetch
- dependency-name: ora
- dependency-name: username
- package-ecosystem: "npm"
directory: "/packages/template/typescript/tmpl"
- package-ecosystem: 'npm'
directory: '/packages/template/typescript/tmpl'
# Check the npm registry for updates every weekday
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/packages/template/typescript-webpack/tmpl"
interval: 'daily'
- package-ecosystem: 'npm'
directory: '/packages/template/typescript-webpack/tmpl'
# Check the npm registry for updates every weekday
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/packages/template/webpack/tmpl"
interval: 'daily'
- package-ecosystem: 'npm'
directory: '/packages/template/webpack/tmpl'
# Check the npm registry for updates every weekday
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
interval: 'daily'
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
interval: 'daily'
12 changes: 5 additions & 7 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ Thanks for filing a pull request!
Please check off all of the steps as they are completed by replacing [ ] with [x].
-->

* [ ] I have read the [contribution documentation](https://github.com/electron-userland/electron-forge/blob/master/CONTRIBUTING.md) for this project.
* [ ] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project follows, as appropriate.
* [ ] The changes are appropriately documented (if applicable).
* [ ] The changes have sufficient test coverage (if applicable).
* [ ] The testsuite passes successfully on my local machine (if applicable).
- [ ] I have read the [contribution documentation](https://github.com/electron-userland/electron-forge/blob/master/CONTRIBUTING.md) for this project.
- [ ] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project follows, as appropriate.
- [ ] The changes are appropriately documented (if applicable).
- [ ] The changes have sufficient test coverage (if applicable).
- [ ] The testsuite passes successfully on my local machine (if applicable).

**Summarize your changes:**


24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
dependabolt:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Use Node.js LTS
uses: actions/[email protected]
with:
node-version: 14.x
cache: yarn
- name: Run dependabolt
if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'dependabot/npm_and_yarn') && !contains(github.event.pull_request.head.ref, 'npm_and_yarn/packages') }}
uses: malept/[email protected]
env:
DEPENDABOLT_SSH_DEPLOY_KEY: ${{ secrets.DEPENDABOLT_SSH_DEPLOY_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/[email protected]
- name: Use Node.js LTS
uses: actions/[email protected]
with:
node-version: 14.x
cache: yarn
- name: Run dependabolt
if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'dependabot/npm_and_yarn') && !contains(github.event.pull_request.head.ref, 'npm_and_yarn/packages') }}
uses: malept/[email protected]
env:
DEPENDABOLT_SSH_DEPLOY_KEY: ${{ secrets.DEPENDABOLT_SSH_DEPLOY_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fast-tests:
runs-on: ${{ matrix.os }}
needs: dependabolt
Expand Down
14 changes: 5 additions & 9 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
const path = require('path')
const path = require('path');

module.exports = {
"require": [
"ts-node/register",
"@babel/register",
path.join(__dirname, "tools", "test-setup.ts")
],
"timeout": 800000,
"recursive": true
}
require: ['ts-node/register', '@babel/register', path.join(__dirname, 'tools', 'test-setup.ts')],
timeout: 800000,
recursive: true,
};
6 changes: 2 additions & 4 deletions .now.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"name": "forge-docs",
"type": "static",
"alias": [
"js.electronforge.io"
]
}
"alias": ["js.electronforge.io"]
}
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.nyc_output
dist/
docs/
packages/*/*/dist
packages/*/*/doc
packages/*/*/index.d.ts
packages/*/*/index.ts
packages/*/*/README.md
packages/*/*/tsconfig.json
packages/api/core/test/fixture/bad_external_forge_config/bad.js
Loading

0 comments on commit 0deb74b

Please sign in to comment.