Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid circular dependencies between packages #4097

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions packages/html/tests/analysis/analyzer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { join } from 'path';
import { setContext } from '@sonar/shared/helpers';
import { embeddedInput } from '../../../jsts/tests/tools';
import { parseHTML } from '../../src/parser';
import { setContext } from '@sonar/shared/helpers';
import { analyzeEmbedded } from '@sonar/jsts/embedded';
import { initializeLinter } from '@sonar/jsts';
import { jsTsInput } from '@sonar/shared/helpers';

describe('analyzeHTML', () => {
const fixturesPath = join(__dirname, 'fixtures');
Expand All @@ -42,7 +42,10 @@ describe('analyzeHTML', () => {
]);
const {
issues: [issue],
} = analyzeEmbedded(await jsTsInput({ filePath: join(fixturesPath, 'file.html') }), parseHTML);
} = analyzeEmbedded(
await embeddedInput({ filePath: join(fixturesPath, 'file.html') }),
parseHTML,
);
expect(issue).toEqual(
expect.objectContaining({
ruleId: 'no-all-duplicated-branches',
Expand All @@ -57,7 +60,7 @@ describe('analyzeHTML', () => {
it('should not break when using a rule with a quickfix', async () => {
initializeLinter([{ key: 'no-extra-semi', configurations: [], fileTypeTarget: ['MAIN'] }]);
const result = analyzeEmbedded(
await jsTsInput({ filePath: join(fixturesPath, 'quickfix.html') }),
await embeddedInput({ filePath: join(fixturesPath, 'quickfix.html') }),
parseHTML,
);

Expand Down Expand Up @@ -90,7 +93,7 @@ describe('analyzeHTML', () => {
},
]);
const { issues } = analyzeEmbedded(
await jsTsInput({ filePath: join(fixturesPath, 'enforce-trailing-comma.html') }),
await embeddedInput({ filePath: join(fixturesPath, 'enforce-trailing-comma.html') }),
parseHTML,
);
expect(issues).toHaveLength(2);
Expand All @@ -117,7 +120,7 @@ describe('analyzeHTML', () => {
{ key: 'for-loop-increment-sign', configurations: [], fileTypeTarget: ['MAIN'] },
]);
const result = analyzeEmbedded(
await jsTsInput({ filePath: join(fixturesPath, 'secondary.html') }),
await embeddedInput({ filePath: join(fixturesPath, 'secondary.html') }),
parseHTML,
);
const {
Expand All @@ -140,7 +143,7 @@ describe('analyzeHTML', () => {
{ key: 'sonar-no-regex-spaces', configurations: [], fileTypeTarget: ['MAIN'] },
]);
const result = analyzeEmbedded(
await jsTsInput({ filePath: join(fixturesPath, 'regex.html') }),
await embeddedInput({ filePath: join(fixturesPath, 'regex.html') }),
parseHTML,
);
const {
Expand Down
2 changes: 1 addition & 1 deletion packages/html/tests/builder/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
import { join } from 'path';
import { parseHTML } from '../../src/parser';
import { embeddedInput } from '../../../jsts/tests/tools';
import { buildSourceCodes } from '@sonar/jsts/embedded';
import { embeddedInput } from '@sonar/shared/helpers';

describe('buildSourceCodes()', () => {
const fixturesPath = join(__dirname, 'fixtures');
Expand Down
2 changes: 1 addition & 1 deletion packages/jsts/tests/analysis/analyzer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
analyzeJSTS,
JsTsAnalysisOutput,
createAndSaveProgram,
} from '@sonar/jsts';
} from '../../src';
import { APIError } from '@sonar/shared/errors';
import { jsTsInput } from '../tools';

Expand Down
2 changes: 1 addition & 1 deletion packages/jsts/tests/builders/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { setContext } from '@sonar/shared/helpers';
import { buildSourceCode } from '@sonar/jsts';
import { buildSourceCode } from '../../src';
import path from 'path';
import { AST } from 'vue-eslint-parser';
import { jsTsInput } from '../tools';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { findNoSonarLines } from '@sonar/jsts';
import { findNoSonarLines } from '../../../../src';
import path from 'path';
import { parseJavaScriptSourceFile } from '../../../tools';

Expand Down
2 changes: 1 addition & 1 deletion packages/jsts/tests/linter/wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
import path from 'path';
import { JsTsLanguage, setContext } from '@sonar/shared/helpers';
import { CustomRule, LinterWrapper, quickFixRules, RuleConfig } from '@sonar/jsts';
import { CustomRule, LinterWrapper, quickFixRules, RuleConfig } from '../../src';
import { parseJavaScriptSourceFile, parseTypeScriptSourceFile } from '../tools';
import { fileReadable } from '@sonar/shared/helpers';

Expand Down
2 changes: 1 addition & 1 deletion packages/jsts/tests/tools/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
export * from './parsing';
export * from '@sonar/shared/helpers/input';
export * from './input';
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { FileType, readFile } from '@sonar/shared/helpers/index';
import { EmbeddedAnalysisInput } from '@sonar/jsts/embedded';
import { JsTsAnalysisInput } from '@sonar/jsts';
import { FileType, readFile } from '@sonar/shared/helpers';
import { EmbeddedAnalysisInput } from '../../../src/embedded';
import { JsTsAnalysisInput } from '../../../src';

type allOptional = {
filePath: string;
Expand Down
1 change: 0 additions & 1 deletion packages/shared/src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ export * from './context';
export * from './debug';
export * from './files';
export * from './language';
export * from './input';
export * from './escape';
2 changes: 1 addition & 1 deletion packages/yaml/tests/analysis/analyzer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import { join } from 'path';
import { setContext } from '@sonar/shared/helpers';
import { parseAwsFromYaml } from '../../src/aws';
import { embeddedInput } from '../../../jsts/tests/tools';
import { analyzeEmbedded, composeSyntheticFilePath } from '@sonar/jsts/embedded';
import { initializeLinter, getLinter } from '@sonar/jsts';
import { APIError } from '@sonar/shared/errors';
import { Rule } from 'eslint';
import { embeddedInput } from '@sonar/shared/helpers';

describe('analyzeYAML', () => {
const fixturesPath = join(__dirname, 'fixtures');
Expand Down
2 changes: 1 addition & 1 deletion packages/yaml/tests/builder/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import * as estree from 'estree';
import { join } from 'path';
import { parseAwsFromYaml } from '../../src/aws';
import { embeddedInput } from '../../../jsts/tests/tools';
import { buildSourceCodes, composeSyntheticFilePath } from '@sonar/jsts/embedded';
import { APIError } from '@sonar/shared/errors';
import { embeddedInput } from '@sonar/shared/helpers';

describe('buildSourceCodes()', () => {
const fixturesPath = join(__dirname, 'fixtures', 'build');
Expand Down