Skip to content

Commit

Permalink
Update ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
hudochenkov committed Nov 10, 2024
1 parent 8ae1e31 commit 1372ac3
Show file tree
Hide file tree
Showing 6 changed files with 3,061 additions and 1,372 deletions.
16 changes: 0 additions & 16 deletions .eslintrc.json

This file was deleted.

23 changes: 23 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { configs } from 'eslint-config-hudochenkov';
import eslintConfigPrettier from 'eslint-config-prettier';
import globals from 'globals';

export default [
...configs.main,
eslintConfigPrettier,
{
languageOptions: {
globals: {
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, 'off'])),
...globals.node,
...globals.jest,
groupTest: true,
runTest: true,
},
},
rules: {
'unicorn/prefer-at': 0,
'no-template-curly-in-string': 0,
},
},
];
21 changes: 14 additions & 7 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,40 @@ class Parser extends PostCSSParser {
token = this.tokenizer.nextToken();

switch (token[0]) {
case 'space':
case 'space': {
this.spaces += token[1];
break;
}

case ';':
case ';': {
this.freeSemicolon(token);
break;
}

case '}':
case '}': {
this.end(token);
break;
}

case 'comment':
case 'comment': {
this.comment(token);
break;
}

case 'at-word':
case 'at-word': {
this.atrule(token);
break;
}

case '{':
case '{': {
this.emptyRule(token);
break;
}

default:
default: {
this.other(token);
break;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/stringifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Stringifier extends PostCSSStringifier {

if (before) {
// STYLED PATCH {
if (typeof child?.source?.start?.offset !== 'undefined') {
if (child?.source?.start?.offset !== undefined) {
before = this.replaceInterpolations(before, child.source.start.offset);
}
// } STYLED PATCH
Expand Down Expand Up @@ -153,7 +153,7 @@ class Stringifier extends PostCSSStringifier {

if (after) {
// STYLED PATCH {
if (typeof node?.source?.end?.offset !== 'undefined') {
if (node?.source?.end?.offset !== undefined) {
after = this.replaceInterpolations(after, node.source.end.offset);
}
// } STYLED PATCH
Expand Down
Loading

0 comments on commit 1372ac3

Please sign in to comment.