stylelint / stylelint-demo

The online demo on the Stylelint website
https://stylelint.io/demo/
MIT License
15 stars 8 forks source link

Update to stylelint 14 and related configs #270

Closed jeddy3 closed 3 years ago

jeddy3 commented 3 years ago

Which issue, if any, is this issue related to?

Closes #268 Closes #237

Is there anything in the PR that needs further explanation?

It's a work in progress that anyone is free to pick up.

All the dependencies are updated but two tests fail:

jeddy3@mac stylelint-demo % npm t

> stylelint-demo@0.0.0 test
> jest

POST /lint 200 53.890 ms - 59
POST /lint 500 6.043 ms - 155
POST /lint 200 2.599 ms - 190
POST /lint 200 1.403 ms - 164
POST /lint 500 1.984 ms - 44
POST /lint 200 3.811 ms - 181
POST /lint 200 29.748 ms - 151
POST /lint 200 1.347 ms - 282
POST /lint 200 106.521 ms - 468
 FAIL  src/server/__tests__/lint-test.js
  ✓ valid, no warnings (92 ms)
  ✕ valid, no warnings, custom syntax (16 ms)
  ✓ CSS warning (9 ms)
  ✓ CSSSyntaxError warning (8 ms)
  ✓ parse config error (8 ms)
  ✓ undefined rule error (9 ms)
  ✓ invalid option warnings (41 ms)
  ✓ invalid option and warning css (6 ms)
  ✕ parse errors warnings (131 ms)

  ● valid, no warnings, custom syntax

    expected 200 "OK", got 500 "Internal Server Error"

      77 |              .post('/lint')
      78 |              .send(body)
    > 79 |              .expect(200)
         |               ^
      80 |              .then((res) => {
      81 |                      expect(res.body).toEqual({
      82 |                              invalidOptionWarnings: [],

      at Object.<anonymous> (src/server/__tests__/lint-test.js:79:4)
      ----
      at Test.Object.<anonymous>.Test._assertStatus (node_modules/supertest/lib/test.js:304:12)
      at node_modules/supertest/lib/test.js:80:15
      at Test.Object.<anonymous>.Test._assertFunction (node_modules/supertest/lib/test.js:338:11)
      at Test.Object.<anonymous>.Test.assert (node_modules/supertest/lib/test.js:209:21)
      at Server.localAssert (node_modules/supertest/lib/test.js:167:12)

  ● parse errors warnings

    expect(received).toEqual(expected) // deep equality

    - Expected  -  5
    + Received  + 10

    @@ -4,10 +4,17 @@
          Object {
            "column": 1,
            "line": 1,
            "node": Object {
              "indexes": Object {},
    +         "inputs": Array [
    +           Object {
    +             "css": "a:b(a:(f)) {}",
    +             "hasBOM": false,
    +             "id": "<input css RQt-Nq>",
    +           },
    +         ],
              "lastEach": 3,
              "nodes": Array [],
              "raws": Object {
                "after": "",
                "before": "",
    @@ -16,19 +23,17 @@
              "selector": "a:b(a:(f))",
              "source": Object {
                "end": Object {
                  "column": 13,
                  "line": 1,
    +             "offset": 12,
                },
    -           "input": Object {
    -             "css": "a:b(a:(f)) {}",
    -             "hasBOM": false,
    -             "id": "<input css 8>",
    -           },
    +           "inputId": 0,
                "start": Object {
                  "column": 1,
                  "line": 1,
    +             "offset": 0,
                },
              },
              "type": "rule",
            },
            "stylelintType": "parseError",

      301 |                     };
      302 |
    > 303 |                     expect(res.body).toEqual(expected);
          |                                      ^
      304 |             });
      305 | });
      306 |

      at src/server/__tests__/lint-test.js:303:21

Test Suites: 1 failed, 1 total
Tests:       2 failed, 7 passed, 9 total
Snapshots:   0 total
Time:        2.322 s
Ran all test suites.

And the demo errors in the browser with:

Uncaught TypeError: Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
    at _nonIterableRest (index.js:16)
    at _slicedToArray (index.js:14)
    at Root (index.js:136)
    at renderWithHooks (react-dom.development.js:14985)
    at mountIndeterminateComponent (react-dom.development.js:17811)
    at beginWork (react-dom.development.js:19049)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
    at invokeGuardedCallback (react-dom.development.js:4056)
    at beginWork$1 (react-dom.development.js:23959)

---

react-dom.development.js:20085 The above error occurred in the <Root> component:

    at Root (webpack://stylelint-demo/./src/common/root/index.js?:50:66)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.

---

react-dom.development.js:23270 Uncaught TypeError: Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
    at _nonIterableRest (index.js:16)
    at _slicedToArray (index.js:14)
    at Root (index.js:136)
    at renderWithHooks (react-dom.development.js:14985)
    at mountIndeterminateComponent (react-dom.development.js:17811)
    at beginWork (react-dom.development.js:19049)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
    at invokeGuardedCallback (react-dom.development.js:4056)
    at beginWork$1 (react-dom.development.js:23959)
jeddy3 commented 3 years ago

Fixed TypeError and failing tests. Ready for review.

jeddy3 commented 3 years ago

Updated to the latest recommended config branch.

When 14.0.0 and related configs are released, we'll need to:

The demo is automatically pushed live on merge.