diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2021-05-05 16:38:52 -0700 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2021-06-08 22:11:42 -0700 |
commit | 8c50f934bc81f224c6d8f521116ddaa5583eef66 (patch) | |
tree | 8b3ee1124e87128b1ca51d89ba77eb8968632dbf | |
parent | ead52f32001cc46695d99cadcf14d5ad3a1c01d9 (diff) | |
download | gjs-8c50f934bc81f224c6d8f521116ddaa5583eef66.tar.gz |
maint: Add linter rule for multiline object literals
This prevents formatting like
doSomething({ a: 1,
b: 2,
c: 3 });
which is often seen in GJS examples floating around the internet.
-rw-r--r-- | .eslintrc.yml | 1 | ||||
-rw-r--r-- | installed-tests/js/testFundamental.js | 12 | ||||
-rw-r--r-- | installed-tests/js/testGObjectClass.js | 6 |
3 files changed, 10 insertions, 9 deletions
diff --git a/.eslintrc.yml b/.eslintrc.yml index 733db371..7ddf0e38 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -189,6 +189,7 @@ rules: object-curly-newline: - error - consistent: true + multiline: true object-curly-spacing: error object-shorthand: error operator-assignment: error diff --git a/installed-tests/js/testFundamental.js b/installed-tests/js/testFundamental.js index a4d0c0f7..7fd111b9 100644 --- a/installed-tests/js/testFundamental.js +++ b/installed-tests/js/testFundamental.js @@ -8,13 +8,13 @@ const TestObj = GObject.registerClass({ Signals: { 'test-fundamental-value-funcs': {param_types: [Regress.TestFundamentalObject.$gtype]}, 'test-fundamental-value-funcs-subtype': {param_types: [Regress.TestFundamentalSubObject.$gtype]}, - 'test-fundamental-no-funcs': {param_types: - Regress.TestFundamentalObjectNoGetSetFunc - ? [Regress.TestFundamentalObjectNoGetSetFunc.$gtype] : []}, + 'test-fundamental-no-funcs': { + param_types: Regress.TestFundamentalObjectNoGetSetFunc + ? [Regress.TestFundamentalObjectNoGetSetFunc.$gtype] : [], + }, 'test-fundamental-no-funcs-subtype': { - param_types: - Regress.TestFundamentalSubObjectNoGetSetFunc - ? [Regress.TestFundamentalSubObjectNoGetSetFunc.$gtype] : [], + param_types: Regress.TestFundamentalSubObjectNoGetSetFunc + ? [Regress.TestFundamentalSubObjectNoGetSetFunc.$gtype] : [], }, }, }, class TestObj extends GObject.Object {}); diff --git a/installed-tests/js/testGObjectClass.js b/installed-tests/js/testGObjectClass.js index 5512dc0e..15878a9b 100644 --- a/installed-tests/js/testGObjectClass.js +++ b/installed-tests/js/testGObjectClass.js @@ -981,9 +981,9 @@ describe('GObject class with JSObject property', function () { }); it('assigns a Function on construct', function () { - expect(() => new MyObjectWithJSObjectProperty({jsobj_prop: () => { - return true; - }})).not.toThrow(); + expect(() => new MyObjectWithJSObjectProperty({ + jsobj_prop: () => true, + })).not.toThrow(); }); it('throws an error when using a boolean value on construct', function () { |