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

style: add additional style rules & apply fixes #75

Merged
merged 25 commits into from
Apr 4, 2023
Merged

Commits on Apr 2, 2023

  1. style: add object-shorthand rule & apply fixes

    This rule ensures
    ```js
    const obj = {
      foo: 'bar',
      baz,
    }
    ```
    
    Instead of allowing
    ```js
    const obj = {
      foo: 'bar',
      baz: baz,
    }
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    1d098f9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    69201da View commit details
    Browse the repository at this point in the history
  3. style: add ts-eslint key-spacing rule & apply fixes

    This rule ensures:
    ```js
    const foo = { bar: 'baz' };
    ```
    
    Instead of allowing:
    ```js
    const foo = { bar:'baz' };
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    9547350 View commit details
    Browse the repository at this point in the history
  4. style: add ts-eslint space-before-blocks rule

    Ensures a space exists before the start of a block that is not on a new line.
    [Documentation](https://typescript-eslint.io/rules/space-before-blocks/)
    
    This rule ensures:
    ```js
    if (foo) {
      //
    }
    ```
    
    Instead of allowing:
    ```js
    if (foo){
      //
    }
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    50ae0df View commit details
    Browse the repository at this point in the history
  5. style: add arrow-spacing rule

    Ensures a space exists before and after the `=>` in an arrow function.
    [Documentation](https://eslint.org/docs/latest/rules/arrow-spacing)
    
    This rule ensures:
    ```js
    () => {
      //
    };
    ```
    
    Instead of allowing:
    ```js
    ()=>{
      //
    };
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    510969d View commit details
    Browse the repository at this point in the history
  6. style: add arrow-parens rule & apply fixes

    Ensures parenthesis around arrow function parameters are only used when required.
    [Documentation](https://eslint.org/docs/latest/rules/arrow-parens)
    
    This rule ensures:
    ```js
    foo => {
      //
    };
    
    (foo, bar) => {
      //
    };
    ```
    
    Instead of allowing:
    ```js
    (foo) => {
      //
    };
    
    (foo, bar) => {
      //
    };
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    6e7ad52 View commit details
    Browse the repository at this point in the history
  7. style: add ts-eslint brace-style rule

    Ensures 1tbs (one true brace style), where braces must be on the same line as the keywords they're associated with.
    [Documentation](https://typescript-eslint.io/rules/brace-style/)
    
    This rule ensures:
    ```js
    if (foo) {
      //
    } else {
      //
    }
    
    try {
      //
    } catch(error) {
      //
    }
    ```
    
    Instead of allowing:
    ```js
    if (foo)
    {
      //
    }
    else {
      //
    }
    
    try
    {
      //
    }
    catch(error)
    {
      //
    }
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    4b009df View commit details
    Browse the repository at this point in the history
  8. style: add ts-eslint member-delimiter-style rule

    Ensures semicolon delimiters between members of interface and type literals.
    [Documentation](https://typescript-eslint.io/rules/member-delimiter-style)
    
    This rule ensures:
    ```js
    interface Foo {
        name: string;
        greet(): string;
    }
    
    type Bar = { name: string }
    type FooBar = { name: string; greet(): string }
    ```
    
    Instead of allowing:
    ```js
    interface Foo {
        name: string
        greet(): string
    }
    
    interface Foo {
        name: string,
        greet(): string,
    }
    
    interface Foo {
        name: string;
        greet(): string
    }
    
    type FooBar = { name: string, greet(): string }
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    fc0f03a View commit details
    Browse the repository at this point in the history
  9. style: add array-bracket-newline rule

    Ensures array brackets are either both on new lines or are both on the same line.
    [Documentation](https://eslint.org/docs/latest/rules/array-bracket-newline)
    
    This rule ensures:
    ```js
    const foo = [];
    
    const foo = [ 1, 2, 3 ];
    
    const foo = [
      1,
      2,
      3,
    ];
    
    const foo = [{
      bar: baz
    }];
    
    const foo = [
      { bar: baz }
    ];
    ```
    
    Instead of allowing:
    ```js
    const foo = [
    ];
    
    const foo = [
      1, 2, 3 ];
    
    const foo = [
      1,
      2,
      3];
    
    const foo = [{
        bar: baz
      }
    ];
    
    const foo = [
      { bar: baz }];
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    50b4cef View commit details
    Browse the repository at this point in the history
  10. style: add object-curly-newline rule

    Ensures object braces are either both on new lines or are both on the same line.
    [Documentation](https://eslint.org/docs/latest/rules/object-curly-newline)
    
    This rule ensures:
    ```js
    const foo = {};
    
    const foo = { bar: baz };
    
    const foo = {
      bar: baz,
    };
    
    const { bar } = obj;
    
    const {
      bar
    } = obj;
    ```
    
    Instead of allowing:
    ```js
    const foo = {
    };
    
    const foo = { bar: baz
    };
    
    const foo = {
      bar: baz};
    
    const { bar
    } = obj;
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    d0a522e View commit details
    Browse the repository at this point in the history
  11. style: add padded-blocks rule & apply fixes

    Ensures there is not a new line before or after the body of a block.
    [Documentation](https://eslint.org/docs/latest/rules/padded-blocks)
    
    This rule ensures:
    ```js
    if (foo) {
      //
    }
    ```
    
    Instead of allowing:
    ```js
    if (foo) {
    
      //
    
    }
    
    if (foo) {
    
      //
    }
    
    if (foo) {
      //
    
    }
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    304c42e View commit details
    Browse the repository at this point in the history
  12. style: add eslint-plugin-import/exports-last rule & apply fixes

    Ensures all exports are declared at the bottom of the file.
    [Documentation](https://github.com/import-js/eslint-plugin-import/blob/5680a1f8d41cd19f9c60d999a6fadf10994a0a64/docs/rules/exports-last.md)
    
    This rule ensures:
    ```js
    const str = 'foo';
    const bool = true;
    
    export {
      str,
      bool,
    };
    ```
    
    ```js
    const str = 'foo';
    
    export const bool = true;
    ```
    
    Instead of allowing:
    ```js
    export const bool = true;
    
    const str = 'foo';
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    02898f1 View commit details
    Browse the repository at this point in the history
  13. style: add ts-eslint indent rule

    Ensures consistent indentation.
    [Documentation](https://typescript-eslint.io/rules/indent)
    
    !! This has [known issues](typescript-eslint/typescript-eslint#1824), revert to ESLint's version if necessary.
    
    This rule ensures:
    ```js
    function foo() {
      if (bar) {
        console.log('baz');
      } else {
        console.log('qux');
      }
    }
    
    switch(a){
      case "a":
        break;
      case "b":
        break;
    }
    ```
    
    Instead of allowing:
    ```js
    function foo() {
     if (bar) {
    console.log('baz');
    } else {
         console.log('qux');
     }
    }
    
    switch(a){
    case "a":
        break;
    case "b":
        break;
    }
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    2406322 View commit details
    Browse the repository at this point in the history
  14. style: add 'no-unused-vars': 'off' as per ts-eslint docs

    We're already using `@typescript-eslint/no-unused-vars`, the
    [docs](https://typescript-eslint.io/rules/no-unused-vars) state to
    explicitly disable `no-unused-vars` to avoid conflicts.
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    3154ea0 View commit details
    Browse the repository at this point in the history
  15. style: switch to ts-eslint's semi rule & apply fixes

    Ensures semicolons are added after each statement, including TypeScript statements.
    [Documentation](https://typescript-eslint.io/rules/semi)
    
    This rule ensures:
    ```js
    type ClientUser = Pick<User, 'id' | 'discord_user_id'>;
    
    const foo = 'bar';
    
    object.foo = function() {
        //
    };
    
    class Foo {
        bar = 1;
    }
    ```
    
    Instead of allowing:
    ```js
    type ClientUser = Pick<User, 'id' | 'discord_user_id'>
    
    const foo = 'bar'
    
    object.foo = function() {
        //
    }
    
    class Foo {
        bar = 1
    }
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    a20ad0c View commit details
    Browse the repository at this point in the history
  16. style: organize eslintrc

    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    6139fa9 View commit details
    Browse the repository at this point in the history
  17. style: add padding-line-between-statements rule for directives

    Ensures there is an empty line after directives.
    [Documentation](https://eslint.org/docs/latest/rules/padding-line-between-statements)
    
    This rule ensures:
    ```js
    'use strict';
    
    const foo = 'bar';
    ```
    
    Instead of allowing:
    ```js
    'use strict';
    const foo = 'bar';
    ```
    devonzara committed Apr 2, 2023
    Configuration menu
    Copy the full SHA
    c976eb7 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    3c2f693 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2023

  1. style: add ts-eslint keyword-spacing rule

    Ensures spacing around keywords such as `if`, `else`, `function`, `try`, `catch`, etc.
    [Documentation](https://typescript-eslint.io/rules/keyword-spacing)
    
    This rule ensures:
    ```js
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    ```
    
    Instead of allowing:
    ```js
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }
    ```
    devonzara committed Apr 4, 2023
    Configuration menu
    Copy the full SHA
    0d99d21 View commit details
    Browse the repository at this point in the history
  2. style: add ts-eslint space-infix-ops rule

    Ensures spacing around operators such as `+`, `-`, `?`, `:`, `=`, etc.
    [Documentation](https://typescript-eslint.io/rules/space-infix-ops)
    
    This rule ensures:
    ```js
    a + b
    
    a       + b
    
    a ? b : c
    
    // `object-curly-spacing` would ensure spacing inside `{}`
    var {a = 0} = bar;
    
    // `key-spacing` would ensure a space after `:`
    const a = {b:1};
    
    function foo(a = 0) {}
    ```
    
    Instead of allowing:
    ```js
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    var {a=0}=bar;
    
    const a={b:1};
    
    function foo(a=0) { }
    ```
    devonzara committed Apr 4, 2023
    Configuration menu
    Copy the full SHA
    a7074f6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5f7f553 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    41949fc View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0231dcd View commit details
    Browse the repository at this point in the history
  6. Merge branch 'main'

    devonzara committed Apr 4, 2023
    Configuration menu
    Copy the full SHA
    7639c06 View commit details
    Browse the repository at this point in the history
  7. style: apply style fixes

    devonzara committed Apr 4, 2023
    Configuration menu
    Copy the full SHA
    c886081 View commit details
    Browse the repository at this point in the history