@master/eslint-plugin-css 2.0.0-rc.34 → 2.0.0-rc.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,25 +7,28 @@ function findLoc(text, lines, startLine, endLine) {
7
7
  let checking = false;
8
8
  for(let i = startLine; i <= endLine; i++){
9
9
  const sourceCodeLine = lines[i - 1];
10
- const index = sourceCodeLine.indexOf(targetLines[checkingTargetLine].replace(/\r\n|\n/, ''));
10
+ const content = targetLines[checkingTargetLine].replace(/\r\n|\n/, '');
11
+ const index = sourceCodeLine.indexOf(content);
11
12
  if (index !== -1) {
12
- if (checkingTargetLine === 0) {
13
- resultStart = {
14
- line: i,
15
- column: index
16
- };
17
- }
18
- if (checkingTargetLine === targetLines.length - 1) {
19
- return {
20
- start: resultStart,
21
- end: {
13
+ if (index === 0 || sourceCodeLine[index - 1].match(/^|[\s"'']/)) {
14
+ if (checkingTargetLine === 0) {
15
+ resultStart = {
22
16
  line: i,
23
- column: index + text.length
24
- }
25
- };
17
+ column: index
18
+ };
19
+ }
20
+ if (checkingTargetLine === targetLines.length - 1 && (sourceCodeLine[index + content.length - 1].match(/$|[\s"'']/) || sourceCodeLine[index + content.length].match(/[\s"'']/))) {
21
+ return {
22
+ start: resultStart,
23
+ end: {
24
+ line: i,
25
+ column: index + text.length
26
+ }
27
+ };
28
+ }
29
+ checking = true;
30
+ checkingTargetLine++;
26
31
  }
27
- checking = true;
28
- checkingTargetLine++;
29
32
  } else {
30
33
  if (checking) {
31
34
  checking = false;
@@ -5,25 +5,28 @@ function findLoc(text, lines, startLine, endLine) {
5
5
  let checking = false;
6
6
  for(let i = startLine; i <= endLine; i++){
7
7
  const sourceCodeLine = lines[i - 1];
8
- const index = sourceCodeLine.indexOf(targetLines[checkingTargetLine].replace(/\r\n|\n/, ''));
8
+ const content = targetLines[checkingTargetLine].replace(/\r\n|\n/, '');
9
+ const index = sourceCodeLine.indexOf(content);
9
10
  if (index !== -1) {
10
- if (checkingTargetLine === 0) {
11
- resultStart = {
12
- line: i,
13
- column: index
14
- };
15
- }
16
- if (checkingTargetLine === targetLines.length - 1) {
17
- return {
18
- start: resultStart,
19
- end: {
11
+ if (index === 0 || sourceCodeLine[index - 1].match(/^|[\s"'']/)) {
12
+ if (checkingTargetLine === 0) {
13
+ resultStart = {
20
14
  line: i,
21
- column: index + text.length
22
- }
23
- };
15
+ column: index
16
+ };
17
+ }
18
+ if (checkingTargetLine === targetLines.length - 1 && (sourceCodeLine[index + content.length - 1].match(/$|[\s"'']/) || sourceCodeLine[index + content.length].match(/[\s"'']/))) {
19
+ return {
20
+ start: resultStart,
21
+ end: {
22
+ line: i,
23
+ column: index + text.length
24
+ }
25
+ };
26
+ }
27
+ checking = true;
28
+ checkingTargetLine++;
24
29
  }
25
- checking = true;
26
- checkingTargetLine++;
27
30
  } else {
28
31
  if (checking) {
29
32
  checking = false;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@master/eslint-plugin-css","type":"module","scripts":{"build":"techor build \"src/**/*.{js,ts}\"","dev":"pnpm build --watch","test":"jest","type-check":"tsc --noEmit","lint":"eslint src"},"keywords":["mastercss","eslint","eslintplugin"],"license":"MIT","description":"Master CSS ESLint Plugin","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/eslint-plugin"},"sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/css":"^2.0.0-rc.34","@master/css-explore-config":"^2.0.0-rc.34","@master/css-validator":"^2.0.0-rc.34","@typescript-eslint/utils":"^7.7.0","synckit":"^0.9.0","typescript-eslint":"^7.7.0"},"devDependencies":{"@angular-eslint/template-parser":"^17.3.0","@master/css-explore-config":"^2.0.0-rc.34","@master/css-shared":"^2.0.0-rc.34","@types/node":"^20.12.7","@typescript-eslint/rule-tester":"^7.7.0","eslint":"^8.57.0","eslint-plugin-markdown":"^4.0.1","eslint-plugin-mdx":"^3.1.5","svelte-eslint-parser":"^0.34.1","ts-node":"^10.9.2","vue-eslint-parser":"^9.4.2"},"version":"2.0.0-rc.34"}
1
+ {"name":"@master/eslint-plugin-css","type":"module","scripts":{"build":"techor build \"src/**/*.{js,ts}\"","dev":"pnpm build --watch","test":"jest","type-check":"tsc --noEmit","lint":"eslint src"},"keywords":["mastercss","eslint","eslintplugin"],"license":"MIT","description":"Master CSS ESLint Plugin","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/eslint-plugin"},"sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/css":"^2.0.0-rc.36","@master/css-explore-config":"^2.0.0-rc.36","@master/css-validator":"^2.0.0-rc.36","@typescript-eslint/utils":"^7.7.0","synckit":"^0.9.0","typescript-eslint":"^7.7.0"},"devDependencies":{"@angular-eslint/template-parser":"^17.3.0","@master/css-explore-config":"^2.0.0-rc.36","@master/css-shared":"^2.0.0-rc.36","@types/node":"^20.12.7","@typescript-eslint/rule-tester":"^7.7.0","eslint":"^8.57.0","eslint-plugin-markdown":"^4.0.1","eslint-plugin-mdx":"^3.1.5","svelte-eslint-parser":"^0.34.1","ts-node":"^10.9.2","vue-eslint-parser":"^9.4.2"},"version":"2.0.0-rc.36"}