lint

ESLint: How can I restrict certain paths with “no-restricted-imports” but allow subpaths?

余生长醉 提交于 2021-01-28 07:35:40
问题 I am using Material-UI and I am switching all my imports from import { Button } from "@material-ui/core"; to import Button from "@material-ui/core/Button"; I wanted to add a lint rule to not allow direct imports from "@material-ui/core", but allow for any subfolders, eg "@material-ui/core/Button". I found a "no-restricted-imports" rule which is supposed to tackle it, but I can only restrict anything under "@material-ui/core", so "@material-ui/core/*" gets restricted as well. I tried several

ESLint: How can I restrict certain paths with “no-restricted-imports” but allow subpaths?

可紊 提交于 2021-01-28 07:21:36
问题 I am using Material-UI and I am switching all my imports from import { Button } from "@material-ui/core"; to import Button from "@material-ui/core/Button"; I wanted to add a lint rule to not allow direct imports from "@material-ui/core", but allow for any subfolders, eg "@material-ui/core/Button". I found a "no-restricted-imports" rule which is supposed to tackle it, but I can only restrict anything under "@material-ui/core", so "@material-ui/core/*" gets restricted as well. I tried several

Android Studio “Wrong argument type for formatting Error” in String.format()

一世执手 提交于 2021-01-27 15:02:20
问题 TextView textview = (TextView)findViewById(timeScore); i = (int)(gridView.getTime() / 1000L); String s = getString(time_score); Object aobj[] = new Object[1]; aobj[0] = Integer.valueOf(i); textview.setText(String.format(s, aobj)); Getting Error in Android Studio in last conversion aobj "Wrong Argument type for formatting argument #1 in time_score: conversion 'd', recevied Object (argument #2 in method call)" 回答1: I think it's because of textview.setText(String.format(s, aobj)); Your string

TextUtils.isEmpty checks for null but lint doesn't recognise

天大地大妈咪最大 提交于 2021-01-27 14:30:11
问题 In the Android studio whenever I proceed with TextUtils.isEmpty check, the lint shows the argument might be null. It doesn't make sense as isEmpty will check for nullability. Is there any way to resolve this issue without using asserts. P.S. ImageUtils.getWidth accepts aspectRatio as null hence no lint warning there. 来源: https://stackoverflow.com/questions/55635564/textutils-isempty-checks-for-null-but-lint-doesnt-recognise

Can I always use lint ignore NewApi instead of different styles.xml files?

天涯浪子 提交于 2021-01-27 02:43:20
问题 I have two styles.xml, one in values another in values-v21 resource folders. values/styles.xml content is: <resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> </resources> values-v21/styles.xml content is: <resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name=

Can I always use lint ignore NewApi instead of different styles.xml files?

空扰寡人 提交于 2021-01-27 02:43:09
问题 I have two styles.xml, one in values another in values-v21 resource folders. values/styles.xml content is: <resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> </resources> values-v21/styles.xml content is: <resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name=

Travis-CI: Do not fail build because of linter warnings

余生颓废 提交于 2021-01-24 08:11:39
问题 I have an old python project that I am trying to progressively clean up using flake8 (to warn about PEP8 issues). I use Travis for continuous integration and want my build to fail if any unit test fails. However, I do not want my build to fail simply because flake8 produced a warning (e.g., about something minor like trailing white space). How do I configure Travis to output flake8 warnings (so that I can resolve them as I have time) without causing them to fail the build? My .travis.yml is

Travis-CI: Do not fail build because of linter warnings

元气小坏坏 提交于 2021-01-24 08:08:18
问题 I have an old python project that I am trying to progressively clean up using flake8 (to warn about PEP8 issues). I use Travis for continuous integration and want my build to fail if any unit test fails. However, I do not want my build to fail simply because flake8 produced a warning (e.g., about something minor like trailing white space). How do I configure Travis to output flake8 warnings (so that I can resolve them as I have time) without causing them to fail the build? My .travis.yml is

Travis-CI: Do not fail build because of linter warnings

徘徊边缘 提交于 2021-01-24 08:07:16
问题 I have an old python project that I am trying to progressively clean up using flake8 (to warn about PEP8 issues). I use Travis for continuous integration and want my build to fail if any unit test fails. However, I do not want my build to fail simply because flake8 produced a warning (e.g., about something minor like trailing white space). How do I configure Travis to output flake8 warnings (so that I can resolve them as I have time) without causing them to fail the build? My .travis.yml is

Travis-CI: Do not fail build because of linter warnings

对着背影说爱祢 提交于 2021-01-24 08:06:14
问题 I have an old python project that I am trying to progressively clean up using flake8 (to warn about PEP8 issues). I use Travis for continuous integration and want my build to fail if any unit test fails. However, I do not want my build to fail simply because flake8 produced a warning (e.g., about something minor like trailing white space). How do I configure Travis to output flake8 warnings (so that I can resolve them as I have time) without causing them to fail the build? My .travis.yml is