no-raw-text fails on line breaks
See original GitHub issueI don’t expect no-raw-text
to fail in this case according to the tests, but it does for me.
import React from "react";
import { View, Text } from "react-native";
export default class Test extends React.Component {
constructor() {
super();
this.state = {};
}
render() {
return (
<View>
<Text>Some text.</Text>
</View>
);
}
}
Run eslint:
/myproject/src/components/Test.js
12:13 error Whitespace(s) cannot be used outside of a <Text> tag react-native/no-raw-text
13:40 error Whitespace(s) cannot be used outside of a <Text> tag react-native/no-raw-text
It’s specifically complaining at the line endings. 🤔
Ideas? Editor line endings are \n
. Here’s the relevant config:
.eslintrc
{
"parserOptions": {
"ecmaVersion": 2018,
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"react",
"react-native",
"prettier"
],
"env": {
"react-native/react-native": true
},
"extends": [
"airbnb",
"plugin:react-native/all",
"plugin:prettier/recommended"
],
"rules": {
"prettier/prettier": "error",
"react/jsx-filename-extension": ["error", { "extensions": [".js", ".jsx"] }]
}
}
package.json:
{
"name": "empty-project-template",
"main": "./index.js",
"private": true,
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"prettier": "prettier src/{,**/}*.js --write",
"eslint": "eslint src/"
},
"dependencies": {
"expo": "^30.0.1",
"prop-types": "^15.6.2",
"react": "16.3.1",
},
"devDependencies": {
"eslint": "^5.9.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-react": "^7.11.1",
"eslint-plugin-react-native": "^3.5.0",
"prettier": "^1.15.3"
}
}
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Regex search fail when input has line breaks - Stack Overflow
Using repr or raw string on a target string is a bad idea! By doing that newline characters are treated as literal '...
Read more >ESLint & Prettierrc - Sumerian school
ES Lint plugin - write your code more clean, tells where you are making mistakes, and generally it's good practice to work in...
Read more >add new line in string - Power Platform Community - Microsoft
Solved: Hi I want to add new line sting which are displaying on label in power app. In below code I am using...
Read more >File Reader issue with csv: in-cell line-breaks - KNIME Forum
SUch csv files are created from Excel when a cell has multiple lines in it. See attachment. The error is: Execute failed: Too...
Read more >ignoring Line breaks within quotes while importing folder
Solved: Hello, i'm pretty new to power bi and I''m trying to import a folder with CSV files in it . The files...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@AleksandrZhukov done, sorry for the wait, but had to fix
npm audit
issues 😃@AleksandrZhukov https://github.com/donovanhiland/eslint-plugin-react-native-210
should give you the errors
The first is expected, the other 3 is the issue