gearheads
/
mastodon
Archived
2
0
Fork 0

Replace from Code Climate to Super-Linter (#18587)

gh/stable
Yamagishi Kazutoshi 2022-06-02 02:22:35 +09:00 committed by GitHub
parent 3f14260574
commit 84266f87e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 799 additions and 742 deletions

View File

@ -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/

View File

@ -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: {

71
.github/workflows/linter.yml vendored 100644
View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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'),

View File

@ -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'),

View File

@ -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%);

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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%;
}
@ -3980,6 +3982,7 @@ a.status-card.compact:hover {
&__menu {
@include search-popout;
padding: 0;
background: $ui-secondary-color;
}
@ -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,13 +6503,15 @@ noscript {
.navigation-bar__actions {
& > .icon-button.close {
will-change: opacity transform;
transition: opacity $duration * 0.5 $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,
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;

View File

@ -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;

View File

@ -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;
@ -243,7 +243,7 @@
padding-top: 70px;
.emoji-mart-no-results-label {
margin-top: .2em;
margin-top: 0.2em;
}
.emoji-mart-emoji:hover::before {

View File

@ -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),
&:required:invalid:not(:placeholder-shown) {
border-color: lighten($error-red, 12%);
@ -425,10 +425,10 @@ code {
color: lighten($error-red, 12%);
}
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,
select {
border-color: lighten($error-red, 12%);
@ -1000,7 +1000,7 @@ code {
flex: 1 1 auto;
}
input[type=text] {
input[type="text"] {
background: transparent;
border: 0;
padding: 10px;

View File

@ -64,8 +64,8 @@
max-width: calc(100% - 45px - 25px);
}
input[type=radio],
input[type=checkbox] {
input[type="radio"],
input[type="checkbox"] {
display: none;
}
@ -73,7 +73,7 @@
flex: 1 1 auto;
}
input[type=text] {
input[type="text"] {
display: block;
box-sizing: border-box;
width: 100%;
@ -109,7 +109,6 @@
box-sizing: border-box;
width: 18px;
height: 18px;
flex: 0 0 auto;
margin-right: 10px;
top: -1px;
border-radius: 50%;
@ -198,7 +197,7 @@
&:active,
&:focus {
background-color: rgba($dark-text-color, .1);
background-color: rgba($dark-text-color, 0.1);
}
}

View File

@ -139,7 +139,7 @@ a.button.logo-button {
.embed,
.public-layout {
.status__content[data-spoiler=folded] {
.status__content[data-spoiler="folded"] {
.e-content {
display: none;
}

View File

@ -38,6 +38,7 @@ $highlight-text-color: $ui-highlight-color !default;
$action-button-color: $ui-base-lighter-color !default;
$passive-text-color: $gold-star !default;
$active-passive-text-color: $success-green !default;
// For texts on inverted backgrounds
$inverted-text-color: $ui-base-color !default;
$lighter-text-color: $ui-base-lighter-color !default;
@ -48,6 +49,7 @@ $cjk-langs: ja, ko, zh-CN, zh-HK, zh-TW;
// Variables for components
$media-modal-media-max-width: 100%;
// put margins on top and bottom of image to avoid the screen covered by image.
$media-modal-media-max-height: 80%;

View File

@ -13,10 +13,10 @@
"test": "${npm_execpath} run test:lint:js && ${npm_execpath} run test:jest",
"test:lint": "${npm_execpath} run test:lint:js && ${npm_execpath} run test:lint:sass",
"test:lint:js": "eslint --ext=js . --cache",
"test:lint:sass": "sass-lint -v",
"test:lint:sass": "stylelint '**/*.scss'",
"test:jest": "cross-env NODE_ENV=test jest",
"format": "prettier --write '**/*.{json,yml}",
"format-check": "prettier --write '**/*.{json,yml}"
"format": "prettier --write '**/*.{json,yml}'",
"format-check": "prettier --write '**/*.{json,yml}'"
},
"repository": {
"type": "git",
@ -43,7 +43,6 @@
"babel-plugin-preval": "^5.1.0",
"babel-plugin-react-intl": "^6.2.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-runtime": "^6.26.0",
"blurhash": "^1.1.5",
"classnames": "^2.3.1",
"color-blend": "^3.0.1",
@ -84,6 +83,7 @@
"offline-plugin": "^5.0.7",
"path-complete-extname": "^1.0.0",
"pg": "^8.5.0",
"postcss": "^8.4.14",
"postcss-loader": "^3.0.0",
"postcss-object-fit-images": "^1.1.2",
"promise.prototype.finally": "^3.1.3",
@ -137,9 +137,9 @@
"ws": "^8.6.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.18.2",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.5",
"babel-eslint": "^10.1.0",
"babel-jest": "^28.1.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "~2.26.0",
@ -148,11 +148,13 @@
"eslint-plugin-react": "~7.30.0",
"jest": "^28.1.0",
"jest-environment-jsdom": "^28.1.0",
"postcss-scss": "^4.0.4",
"prettier": "^2.6.2",
"raf": "^3.4.1",
"react-intl-translations-manager": "^5.0.3",
"react-test-renderer": "^16.14.0",
"sass-lint": "^1.13.1",
"stylelint": "^14.8.5",
"stylelint-config-standard-scss": "^4.0.0",
"webpack-dev-server": "^3.11.3",
"yargs": "^17.5.1"
},

View File

@ -0,0 +1,28 @@
module.exports = {
extends: ['stylelint-config-standard-scss'],
ignoreFiles: [
'app/javascript/styles/mastodon/reset.scss',
'node_modules/**/*',
'vendor/**/*',
],
rules: {
'at-rule-empty-line-before': null,
'color-function-notation': null,
'color-hex-length': null,
'declaration-block-no-redundant-longhand-properties': null,
'max-line-length': null,
'no-descending-specificity': null,
'no-duplicate-selectors': null,
'number-max-precision': 8,
'property-no-unknown': null,
'property-no-vendor-prefix': null,
'selector-class-pattern': null,
'selector-id-pattern': null,
'string-quotes': null,
'value-keyword-case': null,
'value-no-vendor-prefix': null,
'scss/dollar-variable-empty-line-before': null,
'scss/no-global-function-names': null,
},
};

1216
yarn.lock

File diff suppressed because it is too large Load Diff