Skip to content

Commit

Permalink
Merge pull request #595 from protofire/fix-imports-oreder-to-doubleQu…
Browse files Browse the repository at this point in the history
…otes

Fix imports order to double quotes
  • Loading branch information
HarutProtofire authored Nov 21, 2024
2 parents 7a28bd9 + f457af1 commit 371840a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
36 changes: 18 additions & 18 deletions e2e/08-autofix/imports-order/Foo1AfterFix.sol
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import { ReentrancyGuardUpgradeable2 } from '@apenzeppelin/ReentrancyGuardUpgradeable2.sol';
import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';
import 'https://github.com/owner/repo/blob/branch/path/to/Contract2.sol';
import 'https://github.com/owner/repo/blob/branch/path/to/Contract.sol';
import './../../../../token/interfaces/AFakeContract1.sol';
import './../../../../token/interfaces/FakeContract1.sol';
import { FakeContract2 } from './../../../token/interfaces/FakeContract2.sol';
import { FakeContract3 } from './../../../token/interfaces/FakeContract3.sol';
import './../../apath/zContract.sol';
import './../../bpath/otherfolder/otherfolder/aContract.sol';
import { IXTokenFactory, holaquetal } from './../../token/interfaces/IXTokenFactory.sol';
import './../token/interfaces/IXTokenWrapper.sol';
import { IXTokenWrapper2 } from './../token/interfaces/IXTokenWrapper2.sol';
import { Afool1 } from './Afool1.sol';
import { Unauthorized, add as func, Point } from './Foo.sol';
import { Initializable } from './openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import './Ownable.sol';
import './ThisIsAVeryLongFileOnPurposeToTestTheFirstPathShorterThanTheLastOnelooooooooooong.sol';
import { ReentrancyGuardUpgradeable2 } from "@apenzeppelin/ReentrancyGuardUpgradeable2.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "https://github.com/owner/repo/blob/branch/path/to/Contract2.sol";
import "https://github.com/owner/repo/blob/branch/path/to/Contract.sol";
import "./../../../../token/interfaces/AFakeContract1.sol";
import "./../../../../token/interfaces/FakeContract1.sol";
import { FakeContract2 } from "./../../../token/interfaces/FakeContract2.sol";
import { FakeContract3 } from "./../../../token/interfaces/FakeContract3.sol";
import "./../../apath/zContract.sol";
import "./../../bpath/otherfolder/otherfolder/aContract.sol";
import { IXTokenFactory, holaquetal } from "./../../token/interfaces/IXTokenFactory.sol";
import "./../token/interfaces/IXTokenWrapper.sol";
import { IXTokenWrapper2 } from "./../token/interfaces/IXTokenWrapper2.sol";
import { Afool1 } from "./Afool1.sol";
import { Unauthorized, add as func, Point } from "./Foo.sol";
import { Initializable } from "./openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./Ownable.sol";
import "./ThisIsAVeryLongFileOnPurposeToTestTheFirstPathShorterThanTheLastOnelooooooooooong.sol";

contract ImportsOrder {
constructor() {}
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/naming/imports-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class ImportsOrderChecker extends BaseChecker {
let currentStart = Math.min(...this.fromContractImports.map((imp) => imp.range[0]))
// Prepare replacements changing the range
const replacements = this.orderedImports.map((orderedImport) => {
const newText = orderedImport.fullSentence
// replace single quotes by double quotes
const newText = orderedImport.fullSentence.replace(/'/g, '"')
const rangeEnd = currentStart + newText.length

const replacement = {
Expand Down

0 comments on commit 371840a

Please sign in to comment.