jsdoc中的React导入tsint星号必须对齐

时间:2018-08-17 05:47:26

标签: reactjs typescript tslint

我正在尝试使用TypeScript构建一个简单的React应用。 该项目是用
创建的 create-react-app weather-app --scripts-version=react-scripts-ts
Project git repo,我从tslint得到一个错误:(7,1): asterisks in jsdoc must be aligned

使用VS代码版本:1.25.1,我尝试过:
1-按字母顺序对导入内容进行排序-不起作用
2-使用/* tslint:disable:ordered-imports jsdoc-format completed-docs */禁用jdocs规则-也无效。
3-我不得不通过注释一些行来将导入分成模块-没用
4-使用"rules": { "no-console": { "severity": "none", "options": [ "debug", "info", "log", "time", "timeEnd", "trace" ] } } 编辑了tslint.json -错误没有消失。
5-尝试在文件顶部添加实际的jsdoc行,如下所示:

/**
 * This app shows local weather based on browser location.
 */
import { AccessTime } from '@material-ui/icons';
import * as React from 'react';
import './App.css';
import drizzleDay from './img/weather-drizzle-day.png';
import fewClouds from './img/weather-few-clouds.png';
import { getCity } from './services/servicesAPI';
import SmallWeather from './smallWeather/smallWeather';  

短绒棉被困在现在是import * as service from './services/servicesAPI';的第7:1行上

我想做的就是启动应用程序

这是App.tsx的代码

import { AccessTime } from '@material-ui/icons';
import * as React from 'react';
import './App.css';
import drizzleDay from './img/weather-drizzle-day.png';
import fewClouds from './img/weather-few-clouds.png';
import * as service from './services/servicesAPI';
import SmallWeather from './smallWeather/smallWeather';

const iconURL = "http://openweathermap.org/img/w/10d.png";

class App extends React.Component<any, any> {
  constructor(props: any){
      super(props);
      this.state = {
        city_name: "Auckland",
        current_temp: 30,
        current_time: Date.now()
      }
  }

  public render() {
    // assemble options object for toLocaleTimeString() method
    const options = { 
      hour12: false, 
    }
    service.getCity("Auckland");

    const timestamp = new Date(this.state.current_time).toLocaleTimeString("en-NZ", options);

    const data1 = {
      // Had to manually sort it in alphbet. order.
      date: this.state.current_time,
      iconSrc: iconURL,
      temp: 45
    }

    const data2 = {
      date: this.state.current_time,
      iconSrc: drizzleDay,
      temp: 28
    }

    const data3 = {
      date: this.state.current_time,
      iconSrc: fewClouds,
      temp: 30
    }

    return (
      <div className="App">
        <header className="App-header">
          <h1 className="App-title">Welcome to Your Local Weather App</h1>
        </header>
        <div className="mail-view">
          <h3>{this.state.city_name}</h3>
          <p>{this.state.current_temp}<span>C|F</span></p>
          <div className="current-time">
            <AccessTime className="current-time-icon"/>
            <span>{timestamp}</span>
          </div>
          <p>Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
        </div>
        <div className="grid-view">
          <SmallWeather data={data1}/>
          <SmallWeather data={data2}/>
          <SmallWeather data={data3}/>
        </div>
      </div>
    );
  }
}

export default App;

0 个答案:

没有答案