@master/eslint-plugin-css 2.0.0-rc.38 → 2.0.0-rc.39
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.
package/dist/utils/find-loc.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var indexOfAll = require('./index-of-all.cjs');
|
|
4
|
+
|
|
3
5
|
function findLoc(text, lines, startLine, endLine) {
|
|
4
6
|
const targetLines = text.match(/.+(?:\r\n|\n)?/g);
|
|
5
7
|
let checkingTargetLine = 0;
|
|
@@ -8,16 +10,19 @@ function findLoc(text, lines, startLine, endLine) {
|
|
|
8
10
|
for(let i = startLine; i <= endLine; i++){
|
|
9
11
|
const sourceCodeLine = lines[i - 1];
|
|
10
12
|
const content = targetLines[checkingTargetLine].replace(/\r\n|\n/, '');
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
|
|
13
|
+
const indexes = indexOfAll.indexOfAll(sourceCodeLine, content);
|
|
14
|
+
if (indexes.length > 0) {
|
|
15
|
+
for (const index of indexes){
|
|
16
|
+
if (index !== 0 && sourceCodeLine[index - 1].match(/\w/) || index + content.length < sourceCodeLine.length && sourceCodeLine[index + content.length].match(/\w/)) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
14
19
|
if (checkingTargetLine === 0) {
|
|
15
20
|
resultStart = {
|
|
16
21
|
line: i,
|
|
17
22
|
column: index
|
|
18
23
|
};
|
|
19
24
|
}
|
|
20
|
-
if (checkingTargetLine === targetLines.length - 1
|
|
25
|
+
if (checkingTargetLine === targetLines.length - 1) {
|
|
21
26
|
return {
|
|
22
27
|
start: resultStart,
|
|
23
28
|
end: {
|
package/dist/utils/find-loc.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { indexOfAll } from './index-of-all.mjs';
|
|
2
|
+
|
|
1
3
|
function findLoc(text, lines, startLine, endLine) {
|
|
2
4
|
const targetLines = text.match(/.+(?:\r\n|\n)?/g);
|
|
3
5
|
let checkingTargetLine = 0;
|
|
@@ -6,16 +8,19 @@ function findLoc(text, lines, startLine, endLine) {
|
|
|
6
8
|
for(let i = startLine; i <= endLine; i++){
|
|
7
9
|
const sourceCodeLine = lines[i - 1];
|
|
8
10
|
const content = targetLines[checkingTargetLine].replace(/\r\n|\n/, '');
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
|
|
11
|
+
const indexes = indexOfAll(sourceCodeLine, content);
|
|
12
|
+
if (indexes.length > 0) {
|
|
13
|
+
for (const index of indexes){
|
|
14
|
+
if (index !== 0 && sourceCodeLine[index - 1].match(/\w/) || index + content.length < sourceCodeLine.length && sourceCodeLine[index + content.length].match(/\w/)) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
12
17
|
if (checkingTargetLine === 0) {
|
|
13
18
|
resultStart = {
|
|
14
19
|
line: i,
|
|
15
20
|
column: index
|
|
16
21
|
};
|
|
17
22
|
}
|
|
18
|
-
if (checkingTargetLine === targetLines.length - 1
|
|
23
|
+
if (checkingTargetLine === targetLines.length - 1) {
|
|
19
24
|
return {
|
|
20
25
|
start: resultStart,
|
|
21
26
|
end: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function indexOfAll(arr: any[] | string, value: any): number[];
|
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":"
|
|
1
|
+
{"name":"@master/eslint-plugin-css","type":"module","scripts":{"build":"techor build \"src/**/*.{js,ts}\"","dev":"pnpm build --watch","test":"vitest","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.39","@master/css-explore-config":"^2.0.0-rc.39","@master/css-validator":"^2.0.0-rc.39","@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.39","@master/css-shared":"^2.0.0-rc.39","@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.39"}
|