diff options
author | Yamagishi Kazutoshi <ykzts@desire.sh> | 2022-06-02 02:22:35 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-01 19:22:35 +0200 |
commit | 84266f87e7f3ecc0f6b4aa35d18a2a5dccb47cd4 (patch) | |
tree | eb9657fddde70367c1715232874829a91720560a | |
parent | 3f1426057474e15c32b0130280e0349ab5e682c0 (diff) |
Replace from Code Climate to Super-Linter (#18587)
22 files changed, 799 insertions, 742 deletions
diff --git a/.codeclimate.yml b/.codeclimate.yml index ee9022cdaf8..59051aae7a1 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -26,13 +26,11 @@ plugins: bundler-audit: enabled: true eslint: - enabled: true - channel: eslint-7 + enabled: false rubocop: - enabled: true - channel: rubocop-1-9-1 + enabled: false sass-lint: - enabled: true + enabled: false exclude_patterns: - spec/ - vendor/asset/ diff --git a/.eslintrc.js b/.eslintrc.js index 2a882f59c6c..e4ada6fe0d1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -12,7 +12,7 @@ module.exports = { ATTACHMENT_HOST: false, }, - parser: 'babel-eslint', + parser: '@babel/eslint-parser', plugins: [ 'react', @@ -27,7 +27,7 @@ module.exports = { experimentalObjectRestSpread: true, jsx: true, }, - ecmaVersion: 2018, + ecmaVersion: 2021, }, settings: { diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000000..fd535ea9a53 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,71 @@ +--- +################################# +################################# +## Super Linter GitHub Actions ## +################################# +################################# +name: Lint Code Base + +# +# Documentation: +# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions +# + +############################# +# Start the job on all push # +############################# +on: + push: + branches-ignore: [main] + # Remove the line above to run when pushing to master + pull_request: + branches: [main] + +############### +# Set the Job # +############### +permissions: + checks: write + contents: read + pull-requests: write + statuses: write + +jobs: + build: + # Name the Job + name: Lint Code Base + # Set the agent to run on + runs-on: ubuntu-latest + + ################## + # Load all steps # + ################## + steps: + ########################## + # Checkout the code base # + ########################## + - name: Checkout Code + uses: actions/checkout@v3 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: Intall dependencies + run: yarn install --frozen-lockfile + + ################################ + # Run Linter against code base # + ################################ + - name: Lint Code Base + uses: github/super-linter@v4 + env: + CSS_FILE_NAME: stylelint.config.js + DEFAULT_BRANCH: main + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.js + LINTER_RULES_PATH: . + RUBY_CONFIG_FILE: .rubocop.yml + VALIDATE_ALL_CODEBASE: false + VALIDATE_CSS: true + VALIDATE_JAVASCRIPT_ES: true + VALIDATE_RUBY: true diff --git a/.sass-lint.yml b/.sass-lint.yml deleted file mode 100644 index a84adff3fba..00000000000 --- a/.sass-lint.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Linter Documentation: -# https://github.com/sasstools/sass-lint/tree/v1.13.1/docs/options - -files: - include: app/javascript/styles/**/*.scss - ignore: - - app/javascript/styles/mastodon/reset.scss - -rules: - # Disallows - no-color-literals: 0 - no-css-comments: 0 - no-duplicate-properties: 0 - no-ids: 0 - no-important: 0 - no-mergeable-selectors: 0 - no-misspelled-properties: 0 - no-qualifying-elements: 0 - no-transition-all: 0 - no-vendor-prefixes: 0 - - # Nesting - force-element-nesting: 0 - force-attribute-nesting: 0 - force-pseudo-nesting: 0 - - # Name Formats - class-name-format: 0 - leading-zero: 0 - - # Style Guide - attribute-quotes: 0 - hex-length: 0 - indentation: 0 - nesting-depth: 0 - property-sort-order: 0 - quotes: 0 diff --git a/app/javascript/styles/fonts/montserrat.scss b/app/javascript/styles/fonts/montserrat.scss index ea7e04536aa..170fe654294 100644 --- a/app/javascript/styles/fonts/montserrat.scss +++ b/app/javascript/styles/fonts/montserrat.scss @@ -1,6 +1,7 @@ @font-face { - font-family: 'mastodon-font-display'; - src: local('Montserrat'), + font-family: mastodon-font-display; + src: + local('Montserrat'), url('../fonts/montserrat/Montserrat-Regular.woff2') format('woff2'), url('../fonts/montserrat/Montserrat-Regular.woff') format('woff'), url('../fonts/montserrat/Montserrat-Regular.ttf') format('truetype'); @@ -10,8 +11,9 @@ } @font-face { - font-family: 'mastodon-font-display'; - src: local('Montserrat Medium'), + font-family: mastodon-font-display; + src: + local('Montserrat Medium'), url('../fonts/montserrat/Montserrat-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; diff --git a/app/javascript/styles/fonts/roboto-mono.scss b/app/javascript/styles/fonts/roboto-mono.scss index bd9839abfb7..3802212a9b9 100644 --- a/app/javascript/styles/fonts/roboto-mono.scss +++ b/app/javascript/styles/fonts/roboto-mono.scss @@ -1,6 +1,7 @@ @font-face { - font-family: 'mastodon-font-monospace'; - src: local('Roboto Mono'), + font-family: mastodon-font-monospace; + src: + local('Roboto Mono'), url('../fonts/roboto-mono/robotomono-regular-webfont.woff2') format('woff2'), url('../fonts/roboto-mono/robotomono-regular-webfont.woff') format('woff'), url('../fonts/roboto-mono/robotomono-regular-webfont.ttf') format('truetype'), diff --git a/app/javascript/styles/fonts/roboto.scss b/app/javascript/styles/fonts/roboto.scss index f3a6dcb6e77..65715238076 100644 --- a/app/javascript/styles/fonts/roboto.scss +++ b/app/javascript/styles/fonts/roboto.scss @@ -1,6 +1,7 @@ @font-face { - font-family: 'mastodon-font-sans-serif'; - src: local('Roboto Italic'), + font-family: mastodon-font-sans-serif; + src: + local('Roboto Italic'), url('../fonts/roboto/roboto-italic-webfont.woff2') format('woff2'), url('../fonts/roboto/roboto-italic-webfont.woff') format('woff'), url('../fonts/roboto/roboto-italic-webfont.ttf') format('truetype'), @@ -11,8 +12,9 @@ } @font-face { - font-family: 'mastodon-font-sans-serif'; - src: local('Roboto Bold'), + font-family: mastodon-font-sans-serif; + src: + local('Roboto Bold'), url('../fonts/roboto/roboto-bold-webfont.woff2') format('woff2'), url('../fonts/roboto/roboto-bold-webfont.woff') format('woff'), url('../fonts/roboto/roboto-bold-webfont.ttf') format('truetype'), @@ -23,8 +25,9 @@ } @font-face { - font-family: 'mastodon-font-sans-serif'; - src: local('Roboto Medium'), + font-family: mastodon-font-sans-serif; + src: + local('Roboto Medium'), url('../fonts/roboto/roboto-medium-webfont.woff2') format('woff2'), url('../fonts/roboto/roboto-medium-webfont.woff') format('woff'), url('../fonts/roboto/roboto-medium-webfont.ttf') format('truetype'), @@ -35,8 +38,9 @@ } @font-face { - font-family: 'mastodon-font-sans-serif'; - src: local('Roboto'), + font-family: mastodon-font-sans-serif; + src: + local('Roboto'), url('../fonts/roboto/roboto-regular-webfont.woff2') format('woff2'), url('../fonts/roboto/roboto-regular-webfont.woff') format('woff'), url('../fonts/roboto/roboto-regular-webfont.ttf') format('truetype'), diff --git a/app/javascript/styles/mastodon-light/diff.scss b/app/javascript/styles/mastodon-light/diff.scss index 61c2d0d66dd..0bc6247ef2c 100644 --- a/app/javascript/styles/mastodon-light/diff.scss +++ b/app/javascript/styles/mastodon-light/diff.scss @@ -542,10 +542,10 @@ html { } .simple_form { - input[type=text], - input[type=number], - input[type=email], - input[type=password], + input[type="text"], + input[type="number"], + input[type="email"], + input[type="password"], textarea { &:hover { border-color: lighten($ui-base-color, 12%); diff --git a/app/javascript/styles/mastodon-light/variables.scss b/app/javascript/styles/mastodon-light/variables.scss index bc039ff03d5..f6bc3ac9607 100644 --- a/app/javascript/styles/mastodon-light/variables.scss +++ b/app/javascript/styles/mastodon-light/variables.scss @@ -28,10 +28,10 @@ $inverted-text-color: $black !default; $lighter-text-color: $classic-base-color !default; $light-text-color: #444b5d; -//Newly added colors +// Newly added colors $account-background-color: $white !default; -//Invert darkened and lightened colors +// Invert darkened and lightened colors @function darken($color, $amount) { @return hsl(hue($color), saturation($color), lightness($color) + $amount); } diff --git a/app/javascript/styles/mastodon/about.scss b/app/javascript/styles/mastodon/about.scss index 9f2a1a3afa8..ac2fdb2c70a 100644 --- a/app/javascript/styles/mastodon/about.scss +++ b/app/javascript/styles/mastodon/about.scss @@ -41,7 +41,7 @@ $small-breakpoint: 960px; p { margin-top: 0; - margin-bottom: .85em; + margin-bottom: 0.85em; &:last-child { margin-bottom: 0; @@ -73,7 +73,7 @@ $small-breakpoint: 960px; h6 { font-family: $font-display, sans-serif; margin-top: 1.275em; - margin-bottom: .85em; + margin-bottom: 0.85em; font-weight: 500; color: $secondary-text-color; } @@ -436,7 +436,7 @@ $small-breakpoint: 960px; width: 100%; height: 0; border: 0; - border-bottom: 1px solid rgba($ui-base-lighter-color, .6); + border-bottom: 1px solid rgba($ui-base-lighter-color, 0.6); margin: 20px 0; &.spacer { diff --git a/app/javascript/styles/mastodon/admin.scss b/app/javascript/styles/mastodon/admin.scss index 68e6d2482f0..921c529d12b 100644 --- a/app/javascript/styles/mastodon/admin.scss +++ b/app/javascript/styles/mastodon/admin.scss @@ -183,12 +183,9 @@ $content-width: 840px; &-heading { display: flex; - padding-bottom: 36px; border-bottom: 1px solid lighten($ui-base-color, 8%); - margin: -15px -15px 40px 0; - flex-wrap: wrap; align-items: center; justify-content: space-between; @@ -294,7 +291,7 @@ $content-width: 840px; width: 100%; height: 0; border: 0; - border-bottom: 1px solid rgba($ui-base-lighter-color, .6); + border-bottom: 1px solid rgba($ui-base-lighter-color, 0.6); margin: 20px 0; &.spacer { diff --git a/app/javascript/styles/mastodon/basics.scss b/app/javascript/styles/mastodon/basics.scss index 9e63b1d316f..391f1fad9e2 100644 --- a/app/javascript/styles/mastodon/basics.scss +++ b/app/javascript/styles/mastodon/basics.scss @@ -16,7 +16,7 @@ body { text-rendering: optimizelegibility; font-feature-settings: "kern"; text-size-adjust: none; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + -webkit-tap-highlight-color: rgba(0, 0, 0, 0%); -webkit-tap-highlight-color: transparent; &.system-font { @@ -31,7 +31,7 @@ body { // Droid Sans => Older Androids (<4.0) // Helvetica Neue => Older macOS <10.11 // $font-sans-serif => web-font (Roboto) fallback and newer Androids (>=4.0) - font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", $font-sans-serif, sans-serif; + font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", $font-sans-serif, sans-serif; } &.app-body { @@ -202,7 +202,7 @@ button { } p { - margin-bottom: .85em; + margin-bottom: 0.85em; &:last-child { margin-bottom: 0; diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index b066d3abdec..401cf02ac91 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -341,7 +341,6 @@ &__sensitive-button { padding: 10px; padding-top: 0; - font-size: 14px; font-weight: 500; @@ -349,7 +348,7 @@ color: $highlight-text-color; } - input[type=checkbox] { + input[type="checkbox"] { display: none; } @@ -709,7 +708,7 @@ font-size: inherit; vertical-align: middle; object-fit: contain; - margin: -.2ex .15em .2ex; + margin: -0.2ex 0.15em 0.2ex; width: 16px; height: 16px; @@ -1313,9 +1312,9 @@ .account__avatar { @include avatar-radius; + display: block; position: relative; - width: 36px; height: 36px; background-size: 36px 36px; @@ -1328,6 +1327,7 @@ &-composite { @include avatar-radius; + border-radius: 50%; overflow: hidden; position: relative; @@ -1365,6 +1365,7 @@ a .account__avatar { img { @include avatar-radius; + width: 100%; height: 100%; } @@ -1381,6 +1382,7 @@ a .account__avatar { img { @include avatar-radius; + width: 100%; height: 100%; } @@ -2328,7 +2330,7 @@ a.account__display-name { .scrollable { overflow: visible; - @supports(display: grid) { + @supports (display: grid) { contain: content; } } @@ -2751,7 +2753,7 @@ a.account__display-name { overflow-y: auto; } - @supports(display: grid) { // hack to fix Chrome <57 + @supports (display: grid) { // hack to fix Chrome <57 contain: strict; } @@ -2772,7 +2774,7 @@ a.account__display-name { } .scrollable.fullscreen { - @supports(display: grid) { // hack to fix Chrome <57 + @supports (display: grid) { // hack to fix Chrome <57 contain: none; } } @@ -3980,6 +3982,7 @@ a.status-card.compact:hover { &__menu { @include search-popout; + padding: 0; background: $ui-secondary-color; } @@ -4061,7 +4064,7 @@ a.status-card.compact:hover { align-items: center; justify-content: center; - @supports(display: grid) { // hack to fix Chrome <57 + @supports (display: grid) { // hack to fix Chrome <57 contain: strict; } @@ -4878,7 +4881,7 @@ a.status-card.compact:hover { padding: 0; border: 0; font-size: 0; - transition: opacity .2s ease-in-out; + transition: opacity 0.2s ease-in-out; &.active { opacity: 1; @@ -4933,7 +4936,6 @@ a.status-card.compact:hover { height: 100%; box-sizing: border-box; padding: 25px; - display: none; flex-direction: column; align-items: center; justify-content: center; @@ -5274,7 +5276,6 @@ a.status-card.compact:hover { display: block; box-sizing: border-box; width: 100%; - margin: 0; color: $inverted-text-color; background: $simple-background-color; padding: 10px; @@ -5406,7 +5407,6 @@ a.status-card.compact:hover { font-family: inherit; font-size: 14px; resize: none; - border: 0; outline: 0; border-radius: 4px; border: 1px solid $ui-secondary-color; @@ -5857,6 +5857,7 @@ a.status-card.compact:hover { overflow: hidden; position: absolute; } + /* End Media Gallery */ .detailed, @@ -5869,7 +5870,6 @@ a.status-card.compact:hover { .video-player__volume__handle { bottom: 23px; } - } .audio-player { @@ -5991,7 +5991,7 @@ a.status-card.compact:hover { background: linear-gradient(0deg, rgba($base-shadow-color, 0.85) 0, rgba($base-shadow-color, 0.45) 60%, transparent); padding: 0 15px; opacity: 0; - transition: opacity .1s ease; + transition: opacity 0.1s ease; &.active { opacity: 1; @@ -6066,7 +6066,6 @@ a.status-card.compact:hover { .player-button { display: inline-block; outline: 0; - flex: 0 0 auto; background: transparent; padding: 5px; @@ -6237,7 +6236,7 @@ a.status-card.compact:hover { box-shadow: 1px 2px 6px rgba($base-shadow-color, 0.2); .no-reduce-motion & { - transition: opacity .1s ease; + transition: opacity 0.1s ease; } &.active { @@ -6405,14 +6404,13 @@ a.status-card.compact:hover { display: inline-block; padding: 6px 0; line-height: 18px; - cursor: default; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; - input[type=radio], - input[type=checkbox] { + input[type="radio"], + input[type="checkbox"] { display: none; } @@ -6505,14 +6503,16 @@ noscript { .navigation-bar__actions { & > .icon-button.close { will-change: opacity transform; - transition: opacity $duration * 0.5 $delay, - transform $duration $delay; + transition: + opacity $duration * 0.5 $delay, + transform $duration $delay; } & > .compose__action-bar .icon-button { will-change: opacity transform; - transition: opacity $duration * 0.5 $delay + $duration * 0.5, - transform $duration $delay; + transition: + opacity $duration * 0.5 $delay + $duration * 0.5, + transform $duration $delay; } } } @@ -7286,7 +7286,7 @@ noscript { border-radius: 50%; width: 0.625rem; height: 0.625rem; - margin: -.1ex .15em .1ex; + margin: -0.1ex 0.15em 0.1ex; } &__content { @@ -7549,7 +7549,6 @@ noscript { position: absolute; top: 0; left: 0; - pointer-events: 0; width: 100%; height: 100%; border-left: 2px solid $highlight-text-color; diff --git a/app/javascript/styles/mastodon/dashboard.scss b/app/javascript/styles/mastodon/dashboard.scss index 0a881bc1085..7d0e51fdee2 100644 --- a/app/javascript/styles/mastodon/dashboard.scss +++ b/app/javascript/styles/mastodon/dashboard.scss @@ -37,7 +37,6 @@ text-align: center; font-weight: 500; font-size: 24px; - line-height: 21px; color: $primary-text-color; font-family: $font-display, sans-serif; margin-bottom: 20px; diff --git a/app/javascript/styles/mastodon/emoji_picker.scss b/app/javascript/styles/mastodon/emoji_picker.scss index e7305746506..24061d2ca81 100644 --- a/app/javascript/styles/mastodon/emoji_picker.scss +++ b/app/javascript/styles/mastodon/emoji_picker.scss @@ -46,7 +46,7 @@ text-align: center; padding: 12px 4px; overflow: hidden; - transition: color .1s ease-out; + transition: color 0.1s ease-out; cursor: pointer; background: transparent; border: 0; @@ -242,8 +242,8 @@ padding: 5px 6px; padding-top: 70px; - .emoji-mart-no-results-label { - margin-top: .2em; + .emoji-mart-no-results-label { + margin-top: 0.2em; } .emoji-mart-emoji:hover::before { diff --git a/app/javascript/styles/mastodon/forms.scss b/app/javascript/styles/mastodon/forms.scss index 90d56b0759e..94f553b76c2 100644 --- a/app/javascript/styles/mastodon/forms.scss +++ b/app/javascript/styles/mastodon/forms.scss @@ -352,7 +352,7 @@ code { flex: 1 1 auto; } - input[type=checkbox] { + input[type="checkbox"] { position: absolute; left: 0; top: 5px; @@ -368,11 +368,11 @@ code { border-radius: 4px; } - input[type=text], - input[type=number], - input[type=email], - input[type=password], - input[type=url], + input[type="text"], + input[type="number"], + input[type="email"], + input[type="password"], + input[type="url"], textarea { box-sizing: border-box; font-size: 16px; @@ -410,10 +410,10 @@ code { } } - input[type=text], - input[type=number], - input[type=email], - input[type=password] { + input[type="text"], + input[type="number"], + input[type="email"], + input[type="password"] { &:focus:invalid:not(:placeholder-shown), |