Skip to content

Commit

Permalink
Merge power_linting (#30)
Browse files Browse the repository at this point in the history
* Initial commit

* Make heroes-for-hire team CODEOWNERS of this repo (#1)

* Ruby linting gems (#2)

* Create rubocop-powerhome extension

* Introduce rubocop-cobra plugin with all cobra specific cops

* Fix copyright in LICENSE.txt

Co-authored-by: Ben Langfeld <[email protected]>

* Initial workflow setup

* Only release when tests passes

* Fix release command

* Set working directory for ruby build

* Add linux platform

* Remove duplicated run

* Manually require spec helper

* Write some documentation

Co-authored-by: Ben Langfeld <[email protected]>

* Publish to rubygems from workdir (#3)

* Publish to rubygems from workdir

* Switch from defaults to env

* Deploy for testing purpose

* Only release when version file changes

* Set WORKDIR from PROJECT_DIR

* Test release rubocop-cobra

* Only release tagged commits

* Fix release (#4)

Bump gem versions

* Correct links (#5)

* Comply with our own rules in the docs (#6)

* Build on ruby 3.1.2 (#7)

* Build on ruby 3.1.2

* Align required ruby version in Rubocop and gemspecs

* Add overriding AllCops/TargetRubyVersion recomendation

* Bump version

* Add Garett as author (#11)

* Create ViewComponent file placement cop (#10)

* Add debugging tool to rubocop-powerhome

* Add debugging tool to rubocop-cobra

* Create ViewComponentFilePlacement cop

* Small description fixes

Co-authored-by: Carlos Palhares <[email protected]>

* ES Linting lib (#12)

* Introduce @powerhome/eslint-config library

* Initial github workflow

* Release step

* Validate eslint-config project with base config

* Fully switch to yarn

* Fix job names

* Update eslint-config/README.md

Co-authored-by: Ben Langfeld <[email protected]>

Co-authored-by: Ben Langfeld <[email protected]>

* Add publish config to make @powerhome/eslint-config public (#14)

* Configure Renovate (#13)

* Add renovate.json

* Standard renovate rules

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Ben Langfeld <[email protected]>
Co-authored-by: Carlos Palhares <[email protected]>

* Allow for ApplicationComponent namespacing (#25)

* Allow for ApplicationComponent namespacing

* Add Cobra/ViewComponentFilePlacement to default config

* Change version to future version

* Update rubocop-cobra/config/default.yml

Co-authored-by: Gabriel Fernandes Pereira <[email protected]>

Co-authored-by: Carlos Palhares <[email protected]>
Co-authored-by: Gabriel Fernandes Pereira <[email protected]>

* Create Naming/ViewComponent cop (#26)

* Setup rubocop-performance for new naming cop

* Implement naming cop

* Add a cop description with examples

* Do not enforce BlockLength in spec files

* And gemspec

* Add rubocop binstubs

* Add Naming/ViewComponent to default config

Co-authored-by: Carlos Palhares <[email protected]>

* Bump rack from 2.2.3 to 2.2.3.1 in /rubocop-powerhome (#29)

Bumps [rack](https://github.com/rack/rack) from 2.2.3 to 2.2.3.1.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](rack/rack@2.2.3...2.2.3.1)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump rack from 2.2.3 to 2.2.3.1 in /rubocop-cobra (#30)

Bumps [rack](https://github.com/rack/rack) from 2.2.3 to 2.2.3.1.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](rack/rack@2.2.3...2.2.3.1)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Create Style/NoHelpers cop (#28)

* Create Style/NoHelpers cop

* Update rubocop-powerhome/config/default.yml

Co-authored-by: Ben Langfeld <[email protected]>

Co-authored-by: Ben Langfeld <[email protected]>

* Update tj-actions/changed-files action to v22 (#31)

Co-authored-by: Renovate Bot <[email protected]>

* Bump to 0.4.0 (#32)

* Bump to 0.4.0

* Add to CHANGELOGs

* Run bundle in repos

* Update actions/checkout action to v3 (#18)

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Carlos Palhares <[email protected]>

* Fix Naming/ViewComponent - Patch to 0.4.1 (#33)

* Do not fail for classes that do not inherit

* Bump patch version

Co-authored-by: Carlos Palhares <[email protected]>

* Initial portal setup (#34)

* Initial portal setup

* Fix portal

* Update portal.yml

* Add undocumented fields to mkdocs

* Power Linting lives in Power Application Framework

* Split gems into subcomponents. Render docs for each

* Represent eslint-config

Co-authored-by: Ryan Rodriguez <[email protected]>
Co-authored-by: Ryan Rodriguez <[email protected]>

* Pin dependency babel-eslint to v (#15)

Co-authored-by: Renovate Bot <[email protected]>

* Give more useful output on violations (#36)

* Give more useful output on violations

These are the standard options we tend to pass.

* Changelog

* Fix rel links in README (#37)

* Lock file maintenance (#35)

Co-authored-by: Renovate Bot <[email protected]>

* Ensure license compliance (#41)

* Lock file maintenance (#40)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update tj-actions/changed-files action to v23 (#39)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies (#16)

* Update all non-major dependencies

* Fix lockfile

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Carlos Palhares <[email protected]>
Co-authored-by: Jill Klang <[email protected]>

* Update dependency babel-eslint to v10 (#19)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency eslint-plugin-flowtype to v8 (#21)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency eslint-plugin-jsx-control-statements to v3 (#22)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency eslint-webpack-plugin to v3 (#23)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update typescript-eslint monorepo to v5 (major) (#24)

Update typescript-eslint monorepo to v5

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (#42)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies (#44)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Ignore rspec's describe and context on BlockLength (#43)

* Ignore rspec's describe and context on BlockLength

Ignore rspec's describe and context on BlockLength

* Update CHANGELOG

* Update dependency babel-eslint to v10 (#45)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency rubocop to ~> 1.32.0 (#46)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update tj-actions/changed-files action to v24 (#47)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Release version 0.5.0 (#48)

* Bump version 0.5.0

* Update rubocop-powerhome

* Update rubocop-powerhome in rubocop-cobra

* Release by tag name (#49)

* Release by tag name

* Use workflow name

* Remove unnecessary release conditional (#50)

* custom release command (#51)

* Remove unnecessary release conditional

* Release with gem push instead of rake release

* custom release command (#52)

* Remove unnecessary release conditional

* Release with gem push instead of rake release

* Push with release:rubygem_push task

* Update all non-major dependencies to v5.32.0 (#54)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (#53)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies (#55)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (#56)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies (#57)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency typescript to v4.8.2 (#59)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies (#60)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (#61)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies to v5.36.1 (#62)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency rubocop to "~> 1.36.0" (#63)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies (#64)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies (#66)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies to v5.37.0 (#67)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (#65)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (#68)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency @typescript-eslint/parser to v5.38.0 (#69)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency @typescript-eslint/eslint-plugin to v5.38.0 (#70)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (#73)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency node to v14.20.1 (#71)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies to v5.38.1 (#74)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (#76)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Lock file maintenance (#77)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency node to v16 (#72)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update all non-major dependencies (#75)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Move rubocop-cobra

* Move rubocop-powerhome

* Run rubocop-powerhome with multiple versions of rails

* Ignore rails version to run rubocop-cobra

* Ignore Gemfile.lock to support multiple rails versions

* Make rubocop happy - it thinks create is calling FactoryBot.create

* Move eslint-config

* Move documentation and portal setup from power-linting to power-tools

Co-authored-by: Wade Winningham <[email protected]>
Co-authored-by: Ben Langfeld <[email protected]>
Co-authored-by: Garett Arrowood <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Gabriel Fernandes Pereira <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ryan Rodriguez <[email protected]>
Co-authored-by: Ryan Rodriguez <[email protected]>
Co-authored-by: Jill Klang <[email protected]>
Co-authored-by: Jill Klang <[email protected]>
  • Loading branch information
12 people authored Oct 26, 2022
1 parent b07c31d commit 1aaf3e1
Show file tree
Hide file tree
Showing 91 changed files with 4,745 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/eslint-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: eslint-config

on:
push:

env:
PROJECT_DIR: packages/eslint-config
NODE_VERSION: '14.18.1'
REGISTRY_URL: 'https://registry.npmjs.org'

jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v3
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- run: yarn install --frozen-lockfile
working-directory: ${{ env.PROJECT_DIR }}
- name: Run the build script
run: yarn lint
working-directory: ${{ env.PROJECT_DIR }}

release:
needs: build
runs-on: ubuntu-latest
name: Release
if: ${{ contains(github.ref, 'refs/tags/v') && contains(github.ref, github.workflow) }}
steps:
- uses: actions/checkout@v3
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: ${{ env.REGISTRY_URL }}
- run: yarn install --frozen-lockfile
working-directory: ${{ env.PROJECT_DIR }}
- run: yarn publish
working-directory: ${{ env.PROJECT_DIR }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/rubocop-cobra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: rubocop-cobra

on:
push:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
with:
package: ${{ github.workflow }}
ruby: '["2.7.4", "3.1.2"]'
rails: '["any"]'
secrets: inherit
13 changes: 13 additions & 0 deletions .github/workflows/rubocop-powerhome.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: rubocop-powerhome

on:
push:

jobs:
ruby:
uses: ./.github/workflows/_ruby-package.yml
with:
package: ${{ github.workflow }}
ruby: '["2.7.4", "3.1.2"]'
rails: '["7.0.3.1","6.1.6.1","6.0.5.1","5.2.8.1"]'
secrets: inherit
12 changes: 12 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ Lumberaxe handles logging output formatting.

Consent provides permission-based authorization.

[rubocop-powerhome](https://github.com/powerhome/power-tools/blob/main/packages/rubocop-powerhome/docs/README.md) 💎

This gem is focused on providing standard rubocop configuration for Power Home Remodeling ruby apps. See more in [`rubocop-powerhome`](../packages/rubocop-powerhome).

[rubocop-cobra](https://github.com/powerhome/power-tools/blob/main/packages/rubocop-cobra/docs/README.md) 💎

This gem is focused on providing Cops to support a healthy cobra app development. See more in [`rubocop-cobra`](../packages/rubocop-cobra).

[@powerhome/eslint-config](https://github.com/powerhome/power-tools/blob/main/packages/eslint-config/docs/README.md)

Shared eslint-config from Power Home Remodeling.

## Installation 🛠

These packages are all meant to install inside of an application and aren't intended to stand alone; currently, they are all published to [RubyGems](https://rubygems.org/) and you can use standard Bundler methods to install them.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# rubocop:disable RSpec/FactoryBot/ConsistentParenthesesStyle
AuditTracker.setup do
tracker(:user) do
create :created_by, foreign_key: :created_by_id, class_name: "::Internal::User"
Expand All @@ -16,3 +17,4 @@
value: ->(object) { object&.updated_by&.department }
end
end
# rubocop:enable RSpec/FactoryBot/ConsistentParenthesesStyle
1 change: 1 addition & 0 deletions packages/eslint-config/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "@powerhome/eslint-config/base" }
4 changes: 4 additions & 0 deletions packages/eslint-config/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.tmp
node_modules/
**/*.d.ts
**/*.d.ts.map
48 changes: 48 additions & 0 deletions packages/eslint-config/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# @powerhome/eslint-config

Provides eslint-config for Power Home Remodeling apps.

## Installation

Add this line to your application's package.json:

```ruby
"devDependencies": {
...
"@powerhome/eslint-config": "0.1.0",
...
}
```

And then yarn:

$ yarn

## Usage

Assuming it's a typescript app, add an `extends` line to your `.eslintrc.json`:

```js
{
...
extends: [
...
"@powerhome",
],
...
}
```

That's it! You can override the standard configuration after that.

## Flow type apps

For flow-based apps, replace `@powerhome` by `@powerhome/eslint-config/flow`. Note that usage of Flow at Power is not recommended, and all projects should migrate to TypeScript; this set of rules is provided only for transitionary purposes and will be removed in future releases.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/powerhome/power_linting.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
67 changes: 67 additions & 0 deletions packages/eslint-config/lib/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
module.exports = {
root: true,
plugins: ["jsx-control-statements", "react", "react-hooks"],
extends: [
"eslint:recommended",
"plugin:jsx-control-statements/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
],
parser: "babel-eslint",
parserOptions: {
ecmaVersion: 6,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
es6: true,
"jsx-control-statements/jsx-control-statements": true,
node: true,
mocha: true,
},
rules: {
"jsx-control-statements/jsx-jcs-no-undef": 1,
"no-console": 1,
"no-restricted-globals": [1, { name: "moment" }],
"no-use-before-define": [2, { functions: true, classes: true }],
"react/forbid-prop-types": 2,
"react/jsx-boolean-value": 2,
"react/jsx-closing-bracket-location": 1,
"react/jsx-curly-spacing": 2,
"react/jsx-handler-names": 2,
"react/jsx-indent-props": 2,
"react/jsx-key": 2,
"react/jsx-max-props-per-line": 2,
"react/jsx-no-bind": 0,
"react/jsx-no-literals": 1,
"react/jsx-no-undef": [2, { allowGlobals: true }],
"react/jsx-pascal-case": 2,
"react/jsx-sort-props": 2,
"react/jsx-wrap-multilines": 2,
"react/no-danger": 1,
"react/no-did-mount-set-state": 2,
"react/no-did-update-set-state": 2,
"react/no-multi-comp": 1,
"react/no-set-state": 1,
"react/prefer-es6-class": 2,
"react/prop-types": 1,
"react/self-closing-comp": 2,
"react/sort-comp": 1,
},
settings: {
react: {
version: "detect",
},
},
ignorePatterns: [
"**/*.d.ts",
"coverage/**/*",
"doc/**/*",
"node_modules/**/*",
"spec/dummy/**/*",
"vendor/**/*",
],
}
8 changes: 8 additions & 0 deletions packages/eslint-config/lib/flow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: [
"@powerhome/eslint-config/base",
"plugin:flowtype/recommended"
],
plugins: ["flowtype"],
ignorePatterns: ["flow-typed/**/*"],
}
24 changes: 24 additions & 0 deletions packages/eslint-config/lib/typescript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
extends: ["@powerhome/eslint-config/base"],
overrides: [
{
files: ["**/*.ts", "**/*.tsx"],
extends: ["plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
rules: {
"flowtype/no-types-missing-file-annotation": 0,
"jsx-control-statements/jsx-use-if-tag": 0,
"no-use-before-define": 0,
"@typescript-eslint/no-array-constructor": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-unused-vars": 1,
"@typescript-eslint/no-use-before-define": [
2,
{ functions: true, classes: true },
],
},
},
],
}
9 changes: 9 additions & 0 deletions packages/eslint-config/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
site_name: ESLint Config Powerhome
site_description: Provides eslint-config for Power Home Remodeling apps
repo_url: https://github.com/powerhome/power_linting
edit_uri: edit/main/eslint-config/docs/
nav:
- 'Home': 'README.md'

plugins:
- techdocs-core
46 changes: 46 additions & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@powerhome/eslint-config",
"version": "0.1.0",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"exports": {
"./base": "./lib/base.js",
"./flow": "./lib/flow.js",
"./typescript": "./lib/typescript.js",
".": "./lib/typescript.js"
},
"keywords": [
"eslint",
"eslintconfig"
],
"scripts": {
"lint": "eslint lib/*"
},
"peerDependencies": {
"eslint": "7.32.0",
"eslint-plugin-flowtype": "8.0.3",
"eslint-plugin-jsx-control-statements": "3.0.0",
"eslint-plugin-react": "7.31.10",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-webpack-plugin": "3.2.0",
"@typescript-eslint/eslint-plugin": "5.41.0",
"@typescript-eslint/parser": "5.41.0",
"babel-eslint": "8 || 10",
"typescript": "4.8.4"
},
"devDependencies": {
"semver": "7.3.8",
"eslint": "7.32.0",
"eslint-plugin-flowtype": "8.0.3",
"eslint-plugin-jsx-control-statements": "3.0.0",
"eslint-plugin-react": "7.31.10",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-webpack-plugin": "3.2.0",
"@typescript-eslint/eslint-plugin": "5.41.0",
"@typescript-eslint/parser": "5.41.0",
"babel-eslint": "10.1.0",
"typescript": "4.8.4"
}
}
Loading

0 comments on commit 1aaf3e1

Please sign in to comment.