Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add editorconfig, prettier and sync lint rules with GNOME Shells #342

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]

[*.js]
indent_size = 4

[*.[ch]]
indent_size = 2

[*.gresource.xml]
indent_size = 2

[*.ui]
indent_size = 2

[*.{yml,yaml}]
indent_size = 2

[meson.build]
indent_size = 2
9 changes: 7 additions & 2 deletions .github/workflows/run-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "*"
node-version: '*'
- name: Prepare Linters
run: npm i
- name: Run ESLint (*.js)
run: >
git diff --name-only --diff-filter=ACMTUXB origin/${{ github.base_ref }} HEAD |
grep -E "\.js$" |
xargs -r npx eslint
- name: Run Prettier
if: success() || failure()
run: >
git diff --name-only --diff-filter=ACMTUXB origin/${{ github.base_ref }} HEAD |
xargs -r npx prettier -c --ignore-unknown
- name: Run ShellCheck (*.sh)
if: success() || failure()
run: >
Expand All @@ -35,7 +40,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "*"
node-version: '*'
- run: pip install codespell
# The case sensitivity of codespeller for ignore-words seems to be buggy. See
# issue tracker. According to the help page it should be case sensitive but
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ The [metadata](https://github.com/Leleat/Tiling-Assistant/blob/main/tiling-assis
Here is a table showing the GNOME Shell releases and the latest extension version supporting them.

| GNOME Shell | Tiling Assistant |
|:-------------:|:-----------:|
| 45 | 44 |
| 44 | 43 |
| 43 | 43 |
| 42 | 36 |
| 41 | 32 |
| 40 | 32 |
| 3.38 | 23 |
| 3.36 | 23 |
| :---------: | :--------------: |
| 45 | 44 |
| 44 | 43 |
| 43 | 43 |
| 42 | 36 |
| 41 | 32 |
| 40 | 32 |
| 3.38 | 23 |
| 3.36 | 23 |

## Installation

Expand Down
291 changes: 8 additions & 283 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,286 +1,11 @@
// Based on https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/blob/main/lint/eslintrc-gjs.yml#L67

import js from "@eslint/js";
import eslintConfigPrettier from 'eslint-config-prettier';
import gjsConfig from './lint/eslintrc-gjs.config.js';
import gnomeShellConfig from './lint/eslintrc-shell.config.js';
import extensionConfig from './lint/eslintrc-extension.config.js';

export default [
js.configs.recommended,
{
files: ["tiling-assistant@leleat-on-github/**/*.js"],
languageOptions: {
globals: {
ARGV: "readonly",
Debugger: "readonly",
GIRepositoryGType: "readonly",
globalThis: "readonly",
global: "readonly",
imports: "readonly",
Intl: "readonly",
log: "readonly",
logError: "readonly",
print: "readonly",
printerr: "readonly",
window: "readonly",
TextEncoder: "readonly",
TextDecoder: "readonly"
}
},
rules: {
"array-bracket-newline": [
"error",
"consistent"
],
"array-bracket-spacing": [
"error",
"never"
],
"array-callback-return": "error",
"arrow-parens": [
"error",
"as-needed"
],
"arrow-spacing": "error",
"block-scoped-var": "error",
"block-spacing": "error",
"comma-dangle": "error",
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"comma-style": [
"error",
"last"
],
"computed-property-spacing": "error",
"curly": [
"error",
"multi-or-nest",
"consistent"
],
"dot-location": [
"error",
"property"
],
"eol-last": "error",
"eqeqeq": "error",
"func-call-spacing": "error",
"func-name-matching": "error",
"func-style": [
"error",
"declaration",
{
"allowArrowFunctions": true
}
],
"indent": [
"error",
4,
{
"FunctionExpression": {
"parameters": 2
},
"SwitchCase": 1,
"ignoredNodes": ["CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child"],
"MemberExpression": "off"

}
],
"key-spacing": [
"error",
{
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"linebreak-style": [
"error",
"unix"
],
"max-nested-callbacks": "error",
"max-statements-per-line": [
"error",
{ "max": 2 }
],
"new-parens": "error",
"no-array-constructor": "error",
"no-await-in-loop": "error",
"no-caller": "error",
"no-constant-condition": [
"error",
{ "checkLoops": false }
],
"no-div-regex": "error",
"no-empty": [
"error",
{ "allowEmptyCatch": true }
],
"no-extra-bind": "error",
"no-extra-boolean-cast": "off",
"no-extra-parens": [
"error",
"all",
{
"conditionalAssign": false,
"nestedBinaryExpressions": false,
"returnAssign": false
}
],
"no-implicit-coercion": [
"error",
{ "allow": ["!!"] }
],
"no-iterator": "error",
"no-label-var": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-multiple-empty-lines": "error",
"no-multi-spaces": "error",
"no-nested-ternary": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-proto": "error",
"no-prototype-builtins": "off",
"no-restricted-properties": [
"error",
{
"object": "imports",
"property": "format",
"message": "Use template strings"
},
{
"object": "pkg",
"property": "initFormat",
"message": "Use template strings"
},
{
"object": "Lang",
"property": "copyProperties",
"message": "Use Object.assign()"
},
{
"object": "Lang",
"property": "bind",
"message": "Use arrow notation or Function.prototype.bind()"
},
{
"object": "Lang",
"property": "Class",
"message": "Use ES6 classes"
}
],
"no-return-assign": "error",
"no-return-await": "error",
"no-self-compare": "error",
"no-shadow": "error",
"no-shadow-restricted-names": "error",
"no-spaced-func": "error",
"no-tabs": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef": "error",
"no-unneeded-ternary": "error",
"no-unused-vars": [
"error",
{
"vars": "local",
"varsIgnorePattern": "(^unused|_$)",
"argsIgnorePattern": "^(unused|_)"
}
],
"no-useless-call": "error",
"no-useless-computed-key": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-whitespace-before-property": "error",
"no-with": "error",
"nonblock-statement-body-position": [
"error",
"below"
],
"object-curly-newline": [
"error",
{
"consistent": true,
"multiline": true
}
],
"object-curly-spacing": [
"error",
"always"
],
"object-shorthand": "error",
"operator-assignment": "error",
"operator-linebreak": "error",
"padded-blocks": [
"error",
"never"
],
"prefer-numeric-literals": "error",
"prefer-promise-reject-errors": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"quotes": [
"error",
"single",
{ "avoidEscape": true }
],
"require-await": "error",
"rest-spread-spacing": "error",
"semi": [
"error",
"always"
],
"semi-spacing": [
"error",
{
"before": false,
"after": true
}
],
"semi-style": "error",
"space-before-blocks": [
"error",
"always"
],
"space-before-function-paren": [
"error",
{
"named": "never",
"anonymous": "always",
"asyncArrow": "always"
}
],
"space-in-parens": "error",
"space-infix-ops": [
"error",
{ "int32Hint": false }
],
"space-unary-ops": "error",
"switch-colon-spacing": "error",
"symbol-description": "error",
"template-curly-spacing": "error",
"template-tag-spacing": "error",
"unicode-bom": "error",
"wrap-iife": [
"error",
"inside"
],
"yield-star-spacing": "error",
"yoda": "error"
},
}
...gjsConfig,
...gnomeShellConfig,
eslintConfigPrettier,
...extensionConfig,
];
Loading
Loading