我尝试在.eslintrc中添加规则,但它不起作用。
请帮忙。
我从api得到'aa_bb'。我添加了像doc这样的规则,以及某些方法。
它仍然不起作用。我的同学告诉我要删除eslint,他
认为这是多余的。 哦,我无法添加更多细节......
{
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": ["compat"],
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true,
"jest": true,
"jasmine": true
},
"rules": {
"generator-star-spacing": [0],
"consistent-return": [0],
"react/forbid-prop-types": [0],
"react/jsx-filename-extension": [1, { "extensions": [".js"] }],
"global-require": [1],
"import/prefer-default-export": [0],
"react/jsx-no-bind": [0],
"react/prop-types": [0],
"react/prefer-stateless-function": [0],
"react/jsx-wrap-multilines": ["error", {
"declaration": "parens-new-line",
"assignment": "parens-new-line",
"return": "parens-new-line",
"arrow": "parens-new-line",
"condition": "parens-new-line",
"logical": "parens-new-line",
"prop": "ignore"
}],
"no-else-return": [0],
"no-script-url": 0,
"no-restricted-syntax": [0],
"import/no-extraneous-dependencies": [0],
"no-use-before-define": [0],
"jsx-a11y/no-static-element-interactions": [0],
"jsx-a11y/no-noninteractive-element-interactions": [0],
"jsx-a11y/click-events-have-key-events": [0],
"jsx-a11y/anchor-is-valid": [0],
"no-nested-ternary": [0],
"arrow-body-style": [0],
"import/extensions": [0],
"no-bitwise": [0],
"no-cond-assign": [0],
"import/no-unresolved": [0],
"camelcase": [
"error", {
"properties": "never"
}
],
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}],
"object-curly-newline": [0],
"function-paren-newline": [0],
"no-restricted-globals": [0],
"require-yield": [1],
"compat/compat": "error",
// "linebreak-style": ["error", "windows"]
},
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
},
"settings": {
"polyfills": ["fetch", "promises"]
}
}
答案 0 :(得分:1)
这是您的整个public class Tarea extends AsyncTask {
ProgressDialog progressDialog;
String MyURL,MJson;
volatile String data="";
public String getData() {
return data;
}
public Tarea(String myURL, String mJson, Context contexto) {
this.contexto = contexto;
this.MJson=mJson;
this.MyURL=myURL;
}
Context contexto;
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog=new ProgressDialog(contexto);
progressDialog.setMessage("Buscando Paqueterias, por favor espera un momento...");
progressDialog.show();
}
@Override
protected Object doInBackground(Object[] objects) {
if(MyURL!=null&&MJson!=null) {
try {
URL url = new URL(MyURL.toString());
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
conn.setRequestProperty("Accept", "application/json");
conn.setDoOutput(true);
conn.setDoInput(true);
JSONObject MyJson = new JSONObject(MJson);
DataOutputStream os = new DataOutputStream(conn.getOutputStream());
os.writeBytes(MyJson.toString());
os.flush();
os.close();
//Log.i("Status",String.valueOf(conn.getResponseCode()));
//Log.i("MSG", conn.getResponseMessage());
InputStream in = conn.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(in);
int inputStreamData = inputStreamReader.read();
while (inputStreamData != -1) {
char current = (char) inputStreamData;
inputStreamData = inputStreamReader.read();
data += current;
}
} catch (Exception e) {
e.printStackTrace();
}
progressDialog.dismiss();
}else {
Log.i("Error...","Alguna de las variables MyURL o MJson esta vacia...");
}
return data;
}
@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Log.i("REs",data);
}
}
文件,还是只是一个片段?如果是前者,看起来.eslintrc
文件需要以花括号开头和结尾。所以试试:
.eslintrc
如果它只是一个片段,您使用的是什么版本的ESLint?我认为在一些早期的1.x版本中,您使用了代表级别的数字而不是“错误”:
{
"rules": {
"camelcase": ["error", {"properties": "never"}]
}
}
答案 1 :(得分:1)
camelCase是一种命名约定,其中复合词中的每个词除第一个词外均大写。软件开发人员在编写源代码时经常使用camelCase。
camelCase在编程中很有用,因为元素名称不能包含空格。 camelCase的命名约定使化合物名称更具可读性。例如,myOneMethod比myonemethod更易于阅读。
add_bb for addFor
答案 2 :(得分:0)
这向前发展,您现在可以灵活地allow
某些标识符(也可以是正则表达式)变成非大写字母:
{
"rules": {
"camelcase": ["error", {"allow": ["aa_bb"]}]
}
}